mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-22 01:16:07 +02:00
fix: project 404 (#4114)
## About the changes If project doesn't exist, show 404 information.  <!-- 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,
|
StyledTabContainer,
|
||||||
StyledTopRow,
|
StyledTopRow,
|
||||||
} from './Project.styles';
|
} from './Project.styles';
|
||||||
import { Tabs } from '@mui/material';
|
import { Paper, Tabs, Typography } from '@mui/material';
|
||||||
import { Delete, Edit, FileUpload } from '@mui/icons-material';
|
import { Delete, Edit, FileUpload } from '@mui/icons-material';
|
||||||
import useToast from 'hooks/useToast';
|
import useToast from 'hooks/useToast';
|
||||||
import useQueryParams from 'hooks/useQueryParams';
|
import useQueryParams from 'hooks/useQueryParams';
|
||||||
@ -46,7 +46,7 @@ const NAVIGATE_TO_EDIT_PROJECT = 'NAVIGATE_TO_EDIT_PROJECT';
|
|||||||
export const Project = () => {
|
export const Project = () => {
|
||||||
const projectId = useRequiredPathParam('projectId');
|
const projectId = useRequiredPathParam('projectId');
|
||||||
const params = useQueryParams();
|
const params = useQueryParams();
|
||||||
const { project, loading, refetch } = useProject(projectId);
|
const { project, loading, error, refetch } = useProject(projectId);
|
||||||
const ref = useLoading(loading);
|
const ref = useLoading(loading);
|
||||||
const { setToastData } = useToast();
|
const { setToastData } = useToast();
|
||||||
const [modalOpen, setModalOpen] = useState(false);
|
const [modalOpen, setModalOpen] = useState(false);
|
||||||
@ -110,6 +110,17 @@ export const Project = () => {
|
|||||||
/* eslint-disable-next-line */
|
/* 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 () => {
|
const onFavorite = async () => {
|
||||||
if (project?.favorite) {
|
if (project?.favorite) {
|
||||||
await unfavorite(projectId);
|
await unfavorite(projectId);
|
||||||
|
Loading…
Reference in New Issue
Block a user