🐛 Fixed more errors coming from upgrading SvelteKit
This commit is contained in:
+4
-4
@@ -1,16 +1,16 @@
|
||||
import { error } from '@sveltejs/kit';
|
||||
import type { PageLoad } from '@sveltejs/kit';
|
||||
|
||||
export const load: PageLoad = async ({ params, fetch, session }) => {
|
||||
export const load = async ({ params, parent }) => {
|
||||
const { quiz_id } = params;
|
||||
const res = await fetch(`/api/v1/quiz/get/public/${quiz_id}`);
|
||||
const res = await fetch(`${process.env.API_URL}/api/v1/quiz/get/public/${quiz_id}`);
|
||||
const { email } = await parent();
|
||||
if (res.status === 404 || res.status === 400) {
|
||||
throw error(404);
|
||||
} else if (res.status === 200) {
|
||||
const quiz = await res.json();
|
||||
return {
|
||||
quiz: quiz,
|
||||
logged_in: session.authenticated
|
||||
logged_in: Boolean(email)
|
||||
};
|
||||
} else {
|
||||
throw error(500);
|
||||
Reference in New Issue
Block a user