feat: implement redirect after login functionality across multiple pages

This commit is contained in:
Linus Rath
2026-03-11 23:35:00 +01:00
parent a88b4e4407
commit f996ab77b8
6 changed files with 40 additions and 4 deletions
+1
View File
@@ -264,6 +264,7 @@ export default function Home() {
// Redirect to login if not authenticated
useEffect(() => {
if (initialCheckDone && !isAuthenticated && !authLoading) {
try { sessionStorage.setItem('redirect_after_login', window.location.pathname); } catch {}
router.push('/login');
}
}, [initialCheckDone, isAuthenticated, authLoading, router]);