fix: allow landing page to be viewed without authentication
- Remove automatic redirect from "/" to login/dashboard - Allow everyone to view the hackathon landing page - Users can still click "Daftar Sekarang" to go to login This fixes the issue where the landing page immediately redirected to login. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
400daea60f
commit
7404afe466
@@ -54,15 +54,9 @@ export default function RootLayout() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Home page - redirect based on auth status
|
||||
// Home page - allow everyone to view the landing page
|
||||
if (pathname === '/') {
|
||||
if (session) {
|
||||
console.log('[Layout] Already authenticated, redirecting to dashboard');
|
||||
navigate('/dashboard', { replace: true });
|
||||
} else {
|
||||
console.log('[Layout] Not authenticated, redirecting to login');
|
||||
navigate('/auth/login', { replace: true });
|
||||
}
|
||||
console.log('[Layout] Landing page, allowing access');
|
||||
setIsChecking(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,9 +53,8 @@ export const middleware = async ({ request }: LoaderFunctionArgs) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Public routes - redirect to dashboard if already authenticated
|
||||
// Public routes - allow everyone to view the landing page
|
||||
if (mappingPublicRoutes.includes(pathname)) {
|
||||
if (supabaseSession) return redirect('/dashboard');
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user