⬆️ Upgraded SvelteKit

This commit is contained in:
Mawoka
2022-08-18 15:35:01 +02:00
parent 12ec2ebf94
commit 9b79358db3
31 changed files with 198 additions and 324 deletions
@@ -3,22 +3,11 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script context="module">
/** @type {import('@sveltejs/kit').Load} */ export function load({ error, status }) {
return {
props: {
status,
message: error.message
}
};
}
</script>
<script lang="ts">
import { navbarVisible } from '$lib/stores';
import { page } from '$app/stores';
navbarVisible.set(true);
export let status: number;
export let message: string;
let status = $page.status;
</script>
<svelte:head>
@@ -3,33 +3,11 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script lang="ts" context="module">
import type { Load } from '@sveltejs/kit';
export const load: Load = async ({ params, fetch, session }) => {
const { quiz_id } = params;
const res = await fetch(`/api/v1/quiz/get/public/${quiz_id}`);
if (res.status === 404 || res.status === 400) {
return {
status: 404
};
} else if (res.status === 200) {
const quiz = await res.json();
return {
props: {
quiz: quiz,
logged_in: session.authenticated
}
};
} else {
return {
status: 500
};
}
};
</script>
<script lang="ts">
throw new Error(
'@migration task: Add data prop (https://github.com/sveltejs/kit/discussions/5774#discussioncomment-3292707)'
);
import { getLocalization } from '$lib/i18n';
import CollapsSection from '$lib/collapsible.svelte';
import { createTippy } from 'svelte-tippy';