clean sidebar 3
This commit is contained in:
parent
693ca68861
commit
e5dbd1c67c
@ -57,10 +57,13 @@ export function Sidebar({ isOpen, onClose }: SidebarProps) {
|
||||
pathname
|
||||
});
|
||||
|
||||
// Redirect to signin if no session
|
||||
// Show loading state while session is being checked
|
||||
if (status === 'loading') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Show nothing if not authenticated (middleware will handle redirect)
|
||||
if (status === 'unauthenticated') {
|
||||
console.log('No session, redirecting to signin');
|
||||
router.push('/signin');
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -29,8 +29,13 @@ export default withAuth(
|
||||
return true;
|
||||
}
|
||||
|
||||
// Require authentication for protected API endpoints
|
||||
return !!token;
|
||||
// For protected API endpoints, check if the request has a valid session
|
||||
if (!token) {
|
||||
// Return 401 for API routes instead of redirecting
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// For all other routes, require a valid token
|
||||
|
||||
Loading…
Reference in New Issue
Block a user