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

Signed-off-by: Luke Vella <me@lukevella.com>
This commit is contained in:
Luke Vella 2024-08-23 13:20:24 +01:00 committed by GitHub
parent 06e356720a
commit d4bd922ed3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 0 deletions

View file

@ -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,

View file

@ -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 {