Skip to content

Commit

Permalink
do not auto-jump to login page (#513)
Browse files Browse the repository at this point in the history
  • Loading branch information
lihebi authored Sep 7, 2023
1 parent 098b3bf commit 66118aa
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions apps/ui/src/pages/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,32 +347,14 @@ const RepoLists = () => {
};

function NoLogginErrorAlert() {
const nevigate = useNavigate();
const [seconds, setSeconds] = useState<number | null>(3);

useEffect(() => {
if (seconds === 0) {
setSeconds(null);
nevigate("/login");
return;
}
if (seconds === null) return;

const timer = setTimeout(() => {
setSeconds((prev) => prev! - 1);
}, 1000);

return () => clearTimeout(timer);
}, [nevigate, seconds]);

return (
<Box sx={{ maxWidth: "sm", alignItems: "center", m: "auto" }}>
<Alert severity="error">
Please login first! Automatically jump to{" "}
Please{" "}
<Link component={ReactLink} to="/login">
login
</Link>{" "}
page in {seconds} seconds.
first!
</Alert>
</Box>
);
Expand Down

0 comments on commit 66118aa

Please sign in to comment.