diff --git a/src/routes/projects/+page.svelte b/src/routes/projects/+page.svelte index 1e6be42..6f4fd36 100644 --- a/src/routes/projects/+page.svelte +++ b/src/routes/projects/+page.svelte @@ -7,13 +7,21 @@ export let clubProjects = []; onMount(async () => { - const response = await fetch("/api/jam-games", { - method: 'GET', - headers: { - 'Accept': 'application/json' - } - }) - let jamGames = (await response.json()).data; + let jamGames = [] + try { + const response = await fetch(`/api/jam-games`, { + method: 'GET', + headers: { + 'Accept': 'application/json' + } + }) + const responseText = await response.text() + jamGames = JSON.parse(responseText).data + } + catch (error) + { + console.log(error) + } jamGames.forEach((game) => { clubProjects.push({ @@ -24,7 +32,7 @@ }); }); - clubProjects = clubProjects; + clubProjects = clubProjects }); diff --git a/src/routes/zine/+page.js b/src/routes/zine/+page.js index f194a94..40cc128 100644 --- a/src/routes/zine/+page.js +++ b/src/routes/zine/+page.js @@ -1,11 +1,20 @@ export const load = async ({ fetch }) => { - const response = await fetch(`/api/posts`, { - method: 'GET', - headers: { - 'Accept': 'application/json' - } - }) - let posts = await response.json() + + let posts = [] + try { + const response = await fetch(`/api/posts`, { + method: 'GET', + headers: { + 'Accept': 'application/json' + } + }) + const responseText = await response.text() + posts = JSON.parse(responseText) + } + catch (error) + { + console.log(error) + } return { posts