mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-11 00:08:30 +01:00
fix: project 404 (#4114)
## About the changes If project doesn't exist, show 404 information. ![image](https://github.com/Unleash/unleash/assets/2625371/6d7e1dfa-52f0-495b-a559-9733ec0b9340) <!-- Does it close an issue? Multiple? --> Closes [issue/1-1069](https://linear.app/unleash/issue/1-1069/project-doesnt-show-404-if-it-doesnt-exist)
This commit is contained in:
parent
19770fc33c
commit
a073792d8c
@ -14,7 +14,7 @@ import {
|
||||
StyledTabContainer,
|
||||
StyledTopRow,
|
||||
} from './Project.styles';
|
||||
import { Tabs } from '@mui/material';
|
||||
import { Paper, Tabs, Typography } from '@mui/material';
|
||||
import { Delete, Edit, FileUpload } from '@mui/icons-material';
|
||||
import useToast from 'hooks/useToast';
|
||||
import useQueryParams from 'hooks/useQueryParams';
|
||||
@ -46,7 +46,7 @@ const NAVIGATE_TO_EDIT_PROJECT = 'NAVIGATE_TO_EDIT_PROJECT';
|
||||
export const Project = () => {
|
||||
const projectId = useRequiredPathParam('projectId');
|
||||
const params = useQueryParams();
|
||||
const { project, loading, refetch } = useProject(projectId);
|
||||
const { project, loading, error, refetch } = useProject(projectId);
|
||||
const ref = useLoading(loading);
|
||||
const { setToastData } = useToast();
|
||||
const [modalOpen, setModalOpen] = useState(false);
|
||||
@ -110,6 +110,17 @@ export const Project = () => {
|
||||
/* eslint-disable-next-line */
|
||||
}, []);
|
||||
|
||||
if (error?.status === 404) {
|
||||
return (
|
||||
<Paper sx={theme => ({ padding: theme.spacing(2, 4, 4) })}>
|
||||
<Typography variant="h1">404 Not Found</Typography>
|
||||
<Typography>
|
||||
Project <strong>{projectId}</strong> does not exist.
|
||||
</Typography>
|
||||
</Paper>
|
||||
);
|
||||
}
|
||||
|
||||
const onFavorite = async () => {
|
||||
if (project?.favorite) {
|
||||
await unfavorite(projectId);
|
||||
|
Loading…
Reference in New Issue
Block a user