Skip to content

Commit

Permalink
change redirection path to new portal admin
Browse files Browse the repository at this point in the history
  • Loading branch information
SimNed committed Dec 13, 2024
1 parent f2d575b commit 8b810e3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/pages/admin/newportal/h5p/edit/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ const H5pEditContentPage = () => {

const contentId = React.useMemo(() => getQueryString(router.query.id), [router]);
const content = (h5pContent || []).find((h5p) => h5p.contentId === contentId);
const redirectPath = `/admin/newportal/h5p`;

if (h5pContent && !content) {
router.push(`/admin/h5p`);
router.push(redirectPath);
}
if (!content) {
return null;
Expand All @@ -32,7 +33,7 @@ const H5pEditContentPage = () => {
return (
<div>
<Breadcrumbs separator={<NavigateNextIcon fontSize="large" color="primary" />} aria-label="breadcrumb" style={{ marginBottom: '1rem' }}>
<Link href="/admin/h5p" passHref>
<Link href={redirectPath} passHref>
<MaterialLink>
<h1>Contenu H5P</h1>
</MaterialLink>
Expand All @@ -48,7 +49,7 @@ const H5pEditContentPage = () => {
variant: 'success',
});
queryClient.invalidateQueries('h5p');
router.push(`/admin/h5p`);
router.push(redirectPath);
}}
onError={(message) => {
enqueueSnackbar(message, {
Expand All @@ -58,7 +59,7 @@ const H5pEditContentPage = () => {
></H5pEditor>
</div>
</AdminTile>
<Link href="/admin/h5p" passHref>
<Link href={redirectPath} passHref>
<Button variant="outlined" style={{ margin: '1rem 0' }} component="a">
Retour
</Button>
Expand Down

0 comments on commit 8b810e3

Please sign in to comment.