Files
afrobiz/server/trpc/context.ts
2023-09-09 00:01:16 +10:00

13 lines
580 B
TypeScript

import { inferAsyncReturnType } from '@trpc/server'
import { H3Event } from 'h3';
export async function createContext(event: H3Event){
return {
user: event.context.user, // the Supabase User
dbUser: event.context.dbUser, // the corresponding Database User
activeAccountId: event.context.activeAccountId, // the account ID that is active for the user
event, // required to enable setCookie in accountRouter
}
};
export type Context = inferAsyncReturnType<typeof createContext>