Add additional safety check with window navigation for stuck states
cgen-67c5fbd50a11488aa8879c547d0968e1
This commit is contained in:
parent
09ce29f2a1
commit
c89fef26c6
1 changed files with 7 additions and 0 deletions
|
|
@ -58,7 +58,14 @@ export default function Dashboard() {
|
|||
// Force redirect immediately if no user
|
||||
if (!user) {
|
||||
setIsLoading(false);
|
||||
// Use both React Router and window location as fallback
|
||||
navigate("/login", { replace: true });
|
||||
// Fallback in case React Router fails
|
||||
setTimeout(() => {
|
||||
if (!user) {
|
||||
window.location.href = "/login";
|
||||
}
|
||||
}, 500);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue