aboutsummaryrefslogtreecommitdiffstats
path: root/packages/web/server/api/client.ts
blob: 7b4e63783220e662946f0d92240e0c4b798ea7ff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { appRouter } from "./routers/_app";
import { getServerAuthSession } from "@/server/auth";
import { Context, createCallerFactory } from "./trpc";

export const createContext = async (): Promise<Context> => {
  const session = await getServerAuthSession();
  return {
    user: session?.user ?? null,
  };
};

const createCaller = createCallerFactory(appRouter);

export const api = createCaller(createContext);