Compare commits

..

2 commits

Author SHA1 Message Date
43c0311d5b Merge pull request 'hotfix: chapter puzzle show' (#10) from dev into main
Reviewed-on: #10
2023-09-25 10:25:33 +02:00
Théo
8a4cd59068 hotfix: chapter puzzle show 2023-09-25 10:25:03 +02:00

View file

@ -30,7 +30,12 @@ export const load = (async ({ parent, fetch, cookies, params: { chapterId, puzzl
throw redirect(303, `/dashboard/chapters`); throw redirect(303, `/dashboard/chapters`);
} }
if (!chapter.puzzles.some((puzzle) => puzzle.id === parseInt(puzzleId))) { console.log(chapter);
if (
!chapter.puzzles.some((puzzle) => puzzle.id === parseInt(puzzleId)) ||
!chapter.puzzles.find((puzzle) => puzzle.id === parseInt(puzzleId))?.show
) {
throw redirect(303, `/dashboard/chapters/${chapterId}`); throw redirect(303, `/dashboard/chapters/${chapterId}`);
} }
@ -46,6 +51,8 @@ export const load = (async ({ parent, fetch, cookies, params: { chapterId, puzzl
const puzzle = await res.json(); const puzzle = await res.json();
console.log(puzzle);
if (!puzzle) { if (!puzzle) {
throw error(404, 'Puzzle not found'); throw error(404, 'Puzzle not found');
} }