diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index 41772eb..658f35d 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -32,11 +32,16 @@ user = await whoami(); } else { user = null; + + if ($page.url.pathname !== '/') + goto('/login'); // Redirect to login if not authenticated } } catch (error) { console.error('Authentication check failed:', error); isAuthenticated = false; user = null; + if ($page.url.pathname !== '/') + goto('/login'); // Redirect to login if not authenticated } });