diff --git a/src/app/(auth)/layout.tsx b/src/app/(auth)/layout.tsx
index 1285de6..170e403 100644
--- a/src/app/(auth)/layout.tsx
+++ b/src/app/(auth)/layout.tsx
@@ -7,7 +7,13 @@ export default async function AuthLayout({
}: {
children: React.ReactNode
}) {
- const session = await auth()
+ let session = null
+ try {
+ session = await auth()
+ } catch (error) {
+ // Auth check failed, continue as unauthenticated
+ console.error('Auth check failed in auth layout:', error)
+ }
// Redirect logged-in users to their dashboard
if (session?.user) {
@@ -18,6 +24,8 @@ export default async function AuthLayout({
redirect('/jury')
} else if (role === 'OBSERVER') {
redirect('/observer')
+ } else if (role === 'MENTOR') {
+ redirect('/mentor')
}
}
diff --git a/src/app/providers.tsx b/src/app/providers.tsx
index 275b855..a7cbf22 100644
--- a/src/app/providers.tsx
+++ b/src/app/providers.tsx
@@ -1,6 +1,7 @@
'use client'
import { useState } from 'react'
+import { SessionProvider } from 'next-auth/react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { httpBatchLink } from '@trpc/client'
import superjson from 'superjson'
@@ -51,8 +52,10 @@ export function Providers({ children }: { children: React.ReactNode }) {
)
return (
-
- {children}
-
+
+
+ {children}
+
+
)
}