error pages
This commit is contained in:
1 parent
1e26fb1e3b
commit
82dbac9ac9
8 files changed
+92
-6
No files matched your search
@@ -62,6 +62,12 @@ const Login = () => {
|
||||
dispatch(setAuthenticated(true));
|
||||
dispatch(setUser(user));
|
||||
dispatch(setSelectedTeamId(user.teams[0]?.id || null));
|
||||
|
||||
if (user.teams.length === 0) {
|
||||
navigate("/no-team");
|
||||
return;
|
||||
}
|
||||
|
||||
navigate("/");
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import Box from "@mui/material/Box";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { BaseBox } from "@/components/design-elements";
|
||||
import { Button } from "@/components/inputs";
|
||||
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
import { useNavigate } from "react-router";
|
||||
import { useAppDispatch } from "@/hooks/AppHooks";
|
||||
import { usePost } from "@/hooks/UseApi";
|
||||
|
||||
const NoTeam = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
const theme = useTheme();
|
||||
const navigate = useNavigate();
|
||||
const { post } = usePost();
|
||||
|
||||
return (
|
||||
<Stack
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
minHeight="70vh"
|
||||
paddingX={theme.spacing(8)}
|
||||
paddingY={theme.spacing(6)}
|
||||
>
|
||||
<BaseBox
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: theme.spacing(2),
|
||||
maxWidth: 560,
|
||||
width: "100%",
|
||||
padding: theme.spacing(8),
|
||||
margin: theme.spacing(2),
|
||||
}}
|
||||
>
|
||||
<Typography variant="h1">You don't belong to a team yet</Typography>
|
||||
<Typography color="text.secondary">
|
||||
Please contact your administrator to be added to a team.
|
||||
</Typography>
|
||||
<Box>
|
||||
<Button
|
||||
variant="contained"
|
||||
color="accent"
|
||||
onClick={async () => {
|
||||
await post("/auth/logout", {});
|
||||
navigate("/login");
|
||||
dispatch(logout());
|
||||
}}
|
||||
>
|
||||
Logout
|
||||
</Button>
|
||||
</Box>
|
||||
</BaseBox>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
export default NoTeam;
|
||||
@@ -0,0 +1,5 @@
|
||||
const NotFound = () => {
|
||||
return "Not Found, fail";
|
||||
};
|
||||
|
||||
export default NotFound;
|
||||
@@ -35,9 +35,11 @@ const TeamMemberConfig = () => {
|
||||
};
|
||||
|
||||
const handleConfirm = async () => {
|
||||
await deleteFn(`/team-members/${id}`);
|
||||
mutate("/teams/joined");
|
||||
navigate(-1);
|
||||
const res = await deleteFn(`/team-members/${memberId}`);
|
||||
if (res) {
|
||||
mutate("/teams/joined");
|
||||
navigate(-1);
|
||||
}
|
||||
setDialogOpen(false);
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ const getHeaders = (t: Function, uiTimezone: string) => {
|
||||
id: "status",
|
||||
content: t("status"),
|
||||
render: (row) => {
|
||||
console.log(row);
|
||||
return <StatusLabel status={row.status as MonitorStatus} />;
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user