Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

✨ Add locale to user object in trpc context (#1268)

Luke Vellad4bd922ed3a4
diff --git a/apps/web/src/pages/api/trpc/[trpc].ts b/apps/web/src/pages/api/trpc/[trpc].ts
index 8b89856a5..b21a2c655 100644
--- a/apps/web/src/pages/api/trpc/[trpc].ts
+++ b/apps/web/src/pages/api/trpc/[trpc].ts
@@ -39,6 +39,7 @@ const trpcApiHandler = createNextApiHandler<AppRouter>({
return {
id: session.user.id,
isGuest: session.user.email === null,
+ locale: session.user.locale ?? undefined,
};
},
posthogClient: posthog || undefined,
diff --git a/packages/backend/trpc/context.ts b/packages/backend/trpc/context.ts
index 1106c123f..c3e6388df 100644
--- a/packages/backend/trpc/context.ts
+++ b/packages/backend/trpc/context.ts
@@ -6,6 +6,7 @@ import type { PostHog } from "posthog-node";
export type GetUserFn = (opts: CreateNextContextOptions) => Promise<{
id: string;
isGuest: boolean;
+ locale?: string;
} | null>;
export interface TRPCContextParams {