mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-07 21:21:49 +02:00
♻️ Switch to turborepo (#532)
This commit is contained in:
parent
41ef81aa75
commit
0a836aeec7
419 changed files with 2300 additions and 2504 deletions
|
@ -1,27 +0,0 @@
|
|||
import { createProxySSGHelpers } from "@trpc/react-query/ssg";
|
||||
import * as trpc from "@trpc/server";
|
||||
import * as trpcNext from "@trpc/server/adapters/next";
|
||||
import { GetServerSidePropsContext } from "next";
|
||||
import superjson from "superjson";
|
||||
|
||||
import { getCurrentUser } from "../utils/auth";
|
||||
import { appRouter } from "./routers/_app";
|
||||
|
||||
export async function createContext(
|
||||
opts: trpcNext.CreateNextContextOptions | GetServerSidePropsContext,
|
||||
) {
|
||||
const user = await getCurrentUser(opts.req.session);
|
||||
|
||||
return { user, session: opts.req.session };
|
||||
}
|
||||
|
||||
export type Context = trpc.inferAsyncReturnType<typeof createContext>;
|
||||
|
||||
export const createSSGHelperFromContext = async (
|
||||
ctx: GetServerSidePropsContext,
|
||||
) =>
|
||||
createProxySSGHelpers({
|
||||
router: appRouter,
|
||||
ctx: await createContext(ctx),
|
||||
transformer: superjson,
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue