Skip to content

do not auto-jump to login page #513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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