From e08bbaae505f680b7c5add032072ad516092c58d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o?= <43091603+glazk0@users.noreply.github.com> Date: Wed, 13 Sep 2023 17:23:22 +0200 Subject: [PATCH] misc: removed old routes --- src/routes/dashboard/puzzles/+page.server.ts | 45 --------- src/routes/dashboard/puzzles/+page.svelte | 99 -------------------- 2 files changed, 144 deletions(-) delete mode 100644 src/routes/dashboard/puzzles/+page.server.ts delete mode 100644 src/routes/dashboard/puzzles/+page.svelte diff --git a/src/routes/dashboard/puzzles/+page.server.ts b/src/routes/dashboard/puzzles/+page.server.ts deleted file mode 100644 index f9f54d4..0000000 --- a/src/routes/dashboard/puzzles/+page.server.ts +++ /dev/null @@ -1,45 +0,0 @@ -import type { PageServerLoad } from './$types'; -import { API_URL } from '$env/static/private'; -import type { Chapter, Puzzle } from '$lib/types'; - -export const load = (async ({ parent, fetch, cookies }) => { - await parent(); - - const session = cookies.get('session'); - - const res = await fetch(`${API_URL}/chapters`, { - headers: { - Authorization: `Bearer ${session}` - } - }); - - if (!res.ok) { - return { - chapters: [] - }; - } - - const chapters = (await res.json()) as Chapter[]; - - for (const chapter of chapters) { - chapter.puzzles = []; - - const res = await fetch(`${API_URL}/chapter/${chapter.id}`, { - headers: { - Authorization: `Bearer ${session}` - } - }); - - if (!res.ok) continue; - - let { puzzles } = (await res.json()) as { puzzles: Puzzle[] }; - - puzzles = puzzles.sort((a, b) => a.scoreMax - b.scoreMax); - - chapter.puzzles = puzzles; - } - - return { - chapters - }; -}) satisfies PageServerLoad; diff --git a/src/routes/dashboard/puzzles/+page.svelte b/src/routes/dashboard/puzzles/+page.svelte deleted file mode 100644 index 86a6bfc..0000000 --- a/src/routes/dashboard/puzzles/+page.svelte +++ /dev/null @@ -1,99 +0,0 @@ - - -
- {#each chapters as chapter} -
-
-
-

{chapter.name}

- -
-
- {#if chapter.startDate && chapter.endDate} -
- - - {new Date(chapter.startDate).toLocaleDateString('fr-FR', { - day: 'numeric', - month: 'long', - year: 'numeric', - hour: 'numeric', - minute: 'numeric' - })}{' '} - -{' '} - {new Date(chapter.endDate).toLocaleDateString('fr-FR', { - day: 'numeric', - month: 'long', - year: 'numeric', - hour: 'numeric', - minute: 'numeric' - })} - -
- {:else} -
-
-
- {/if} -
- -
-
-
-
    - {#each chapter.puzzles as puzzle} - - {/each} -
- -
- {/each} -