remove uneccessary clerk code

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-04-17 10:11:51 +02:00
committed by Carl-Gerhard Lindesvärd
parent e11ed557dc
commit f4c79710e5
2 changed files with 2 additions and 7 deletions

View File

@@ -17,7 +17,7 @@ import superjson from 'superjson';
import { OpenpanelProvider } from '@openpanel/nextjs'; import { OpenpanelProvider } from '@openpanel/nextjs';
function AllProviders({ children }: { children: React.ReactNode }) { function AllProviders({ children }: { children: React.ReactNode }) {
const { getToken, userId } = useAuth(); const { userId } = useAuth();
const [queryClient] = useState( const [queryClient] = useState(
() => () =>
new QueryClient({ new QueryClient({
@@ -36,9 +36,6 @@ function AllProviders({ children }: { children: React.ReactNode }) {
links: [ links: [
httpLink({ httpLink({
url: `${process.env.NEXT_PUBLIC_DASHBOARD_URL}/api/trpc`, url: `${process.env.NEXT_PUBLIC_DASHBOARD_URL}/api/trpc`,
async headers() {
return { Authorization: `Bearer ${await getToken()}` };
},
}), }),
], ],
}) })

View File

@@ -1,4 +1,3 @@
import { clerkClient } from '@clerk/nextjs';
import type { getAuth } from '@clerk/nextjs/server'; import type { getAuth } from '@clerk/nextjs/server';
import { initTRPC, TRPCError } from '@trpc/server'; import { initTRPC, TRPCError } from '@trpc/server';
import superjson from 'superjson'; import superjson from 'superjson';
@@ -31,10 +30,9 @@ const enforceUserIsAuthed = t.middleware(async ({ ctx, next }) => {
throw new TRPCError({ code: 'UNAUTHORIZED', message: 'Not authenticated' }); throw new TRPCError({ code: 'UNAUTHORIZED', message: 'Not authenticated' });
} }
try { try {
const user = await clerkClient.users.getUser(ctx.session.userId);
return next({ return next({
ctx: { ctx: {
session: { ...ctx.session, user }, session: { ...ctx.session },
}, },
}); });
} catch (error) { } catch (error) {