From f4c79710e51c0cc7603abb824186df716c2a94c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Gerhard=20Lindesva=CC=88rd?= Date: Wed, 17 Apr 2024 10:11:51 +0200 Subject: [PATCH] remove uneccessary clerk code --- apps/dashboard/src/app/providers.tsx | 5 +---- apps/dashboard/src/trpc/api/trpc.ts | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/dashboard/src/app/providers.tsx b/apps/dashboard/src/app/providers.tsx index 4146bd8f..f2b08ee9 100644 --- a/apps/dashboard/src/app/providers.tsx +++ b/apps/dashboard/src/app/providers.tsx @@ -17,7 +17,7 @@ import superjson from 'superjson'; import { OpenpanelProvider } from '@openpanel/nextjs'; function AllProviders({ children }: { children: React.ReactNode }) { - const { getToken, userId } = useAuth(); + const { userId } = useAuth(); const [queryClient] = useState( () => new QueryClient({ @@ -36,9 +36,6 @@ function AllProviders({ children }: { children: React.ReactNode }) { links: [ httpLink({ url: `${process.env.NEXT_PUBLIC_DASHBOARD_URL}/api/trpc`, - async headers() { - return { Authorization: `Bearer ${await getToken()}` }; - }, }), ], }) diff --git a/apps/dashboard/src/trpc/api/trpc.ts b/apps/dashboard/src/trpc/api/trpc.ts index df7673cd..278e4ba8 100644 --- a/apps/dashboard/src/trpc/api/trpc.ts +++ b/apps/dashboard/src/trpc/api/trpc.ts @@ -1,4 +1,3 @@ -import { clerkClient } from '@clerk/nextjs'; import type { getAuth } from '@clerk/nextjs/server'; import { initTRPC, TRPCError } from '@trpc/server'; import superjson from 'superjson'; @@ -31,10 +30,9 @@ const enforceUserIsAuthed = t.middleware(async ({ ctx, next }) => { throw new TRPCError({ code: 'UNAUTHORIZED', message: 'Not authenticated' }); } try { - const user = await clerkClient.users.getUser(ctx.session.userId); return next({ ctx: { - session: { ...ctx.session, user }, + session: { ...ctx.session }, }, }); } catch (error) {