Skip to content

Commit

Permalink
fix(loginprotected.jsx): fix no redirect when signout
Browse files Browse the repository at this point in the history
  • Loading branch information
junglesub committed Jul 30, 2024
1 parent db450d6 commit de82021
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/LoginProtected.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ function LoginProtected({ comp: Comp }) {

useEffect(() => {
if (!jwtValue) navigate("/");
}, []);
});

if (jwtValue) {
if (typeof Comp === "object") return <>{Comp}</>;
return <Comp />;
}

return (
<div>
Please redirect <Link to="/">To Home</Link> and Login
<div style={{ color: "white" }}>
Please redirect{" "}
<Link to="/" style={{ color: "skyblue" }}>
To Home
</Link>{" "}
and Login
</div>
);
}
Expand Down

0 comments on commit de82021

Please sign in to comment.