diff --git a/middleware.ts b/middleware.ts index bc5de9f..7693a2f 100644 --- a/middleware.ts +++ b/middleware.ts @@ -49,7 +49,7 @@ export async function middleware(request: NextRequest) { } } - if (user && !isPublicRoute && !isSharedRoute && pathname !== '/') { + if (user && !isPublicRoute && !isSharedRoute && !pathname.startsWith('/api/') && pathname !== '/') { const { data: profile } = await supabase.from('users').select('role').eq('id', user.id).single() const role = profile?.role if (isValidRole(role) && role !== 'admin') {