From 54aa2d833753ebf918285b7562e43859ac36b8ed Mon Sep 17 00:00:00 2001 From: Zachary Ross Date: Wed, 17 Apr 2024 21:18:15 -0400 Subject: [PATCH] Attempt to fix more build errors --- src/app.html | 2 ++ src/routes/projects.svelte | 41 ++++++++++++++++++++++---------- src/routes/projects/+page.svelte | 4 ++++ src/routes/zine/+page.js | 6 +++++ 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/app.html b/src/app.html index 77a5ff52..4adb46ed 100644 --- a/src/app.html +++ b/src/app.html @@ -5,6 +5,8 @@ %sveltekit.head% + +
%sveltekit.body%
diff --git a/src/routes/projects.svelte b/src/routes/projects.svelte index d3cadbb8..515ce2ea 100644 --- a/src/routes/projects.svelte +++ b/src/routes/projects.svelte @@ -6,20 +6,37 @@ const preview_count = 7 onMount(async () => { - const response = await fetch("/api/jam-games"); - 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() + if (responseText == "Not found") + { + return + } + jamGames = JSON.parse(responseText).data + } + catch (error) + { + console.log(error) + } - jamGames.forEach((game) => { - clubProjects.push({ - name: game.game.title, - author: game.game.user.name, - url: game.game.url, - image: game.game.cover, - }); - }); + jamGames.forEach((game) => { + clubProjects.push({ + name: game.game.title, + author: game.game.user.name, + url: game.game.url, + image: game.game.cover, + }); + }); - clubProjects = clubProjects; - clubProjects = clubProjects.slice(0,7) + clubProjects = clubProjects + clubProjects = clubProjects.slice(0,7) }); diff --git a/src/routes/projects/+page.svelte b/src/routes/projects/+page.svelte index 6f4fd36c..6eef7a34 100644 --- a/src/routes/projects/+page.svelte +++ b/src/routes/projects/+page.svelte @@ -16,6 +16,10 @@ } }) const responseText = await response.text() + if (responseText == "Not found") + { + return + } jamGames = JSON.parse(responseText).data } catch (error) diff --git a/src/routes/zine/+page.js b/src/routes/zine/+page.js index 40cc128c..f9592d0f 100644 --- a/src/routes/zine/+page.js +++ b/src/routes/zine/+page.js @@ -9,6 +9,12 @@ export const load = async ({ fetch }) => { } }) const responseText = await response.text() + if (responseText == "Not found") + { + return { + posts + } + } posts = JSON.parse(responseText) } catch (error)