fix: resolve redirect loop after login

- Update middleware to use getAll/setAll cookie methods for better session handling
- Replace router.push with window.location.href for full page reload
- This ensures middleware properly detects authenticated session
This commit is contained in:
Millian Lamiaux
2026-03-17 11:16:33 +01:00
parent e0057e18e0
commit d2babbeee3
2 changed files with 40 additions and 25 deletions

View File

@@ -43,8 +43,8 @@ export default function LoginPage() {
throw new Error("Not authorized as admin");
}
router.push("/");
router.refresh();
// Force a full page reload to ensure middleware picks up the session
window.location.href = "/";
} catch (err) {
setError(err instanceof Error ? err.message : "Login failed");
} finally {