diff --git a/frontend/src/routes/form/[slug]/+page.svelte b/frontend/src/routes/form/[slug]/+page.svelte index 8cabba5..d59a2b0 100644 --- a/frontend/src/routes/form/[slug]/+page.svelte +++ b/frontend/src/routes/form/[slug]/+page.svelte @@ -3,6 +3,7 @@ import AnswerBox from "../../../components/form/answerbox/AnswerBox.svelte"; import Footer from "../../../components/form/footer/Footer.svelte"; import { onMount } from "svelte" + import { browser } from "$app/environment"; export let data; @@ -12,7 +13,7 @@ let questionNumber: number = 0 // Reactive statement to react on 'data.slug' changes - $: if (data && data.slug !== undefined) { + $: if (data && data.slug !== undefined && browser) { questionNumber = data.slug; updateQuestionData(); } diff --git a/frontend/src/routes/form/[slug]/+page.server.ts b/frontend/src/routes/form/[slug]/+page.ts similarity index 79% rename from frontend/src/routes/form/[slug]/+page.server.ts rename to frontend/src/routes/form/[slug]/+page.ts index 7a6a844..1e5d998 100644 --- a/frontend/src/routes/form/[slug]/+page.server.ts +++ b/frontend/src/routes/form/[slug]/+page.ts @@ -1,6 +1,6 @@ import { error } from "@sveltejs/kit"; -/** @type {import('./$types').PageServerLoad} */ +/** @type {import('./$types').PageLoad} */ export async function load({ params }) { let questionNumber = params;