Skip to content

Commit

Permalink
Properly fix trpc context handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Allypost committed Sep 19, 2023
1 parent 8f6de72 commit 5bb234d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/server/api/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@ export const createServerTRPCContext = async (
| Pick<GetServerSidePropsContext, "req" | "res">
| Pick<GetServerSidePropsContext, never>,
) => {
let user = null;
let session = null;
if ("req" in opts && "res" in opts) {
const { req, res } = opts;

// Get the session from the server using the getServerSession wrapper function
const session = await getServerAuthSession({ req, res });
user = session?.user;
session = await getServerAuthSession({ req, res });
}

return createInnerTRPCContext({
Expand Down

0 comments on commit 5bb234d

Please sign in to comment.