From 2856925560ac069f9b9f7ad87f0ea319a5d54547 Mon Sep 17 00:00:00 2001 From: allurei Date: Thu, 19 Dec 2024 16:01:29 +0200 Subject: [PATCH] error page and fetch posts to page.server.js --- src/routes/+error.svelte | 9 +++++++++ src/routes/tesmi/{+page.js => +page.server.js} | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/routes/+error.svelte rename src/routes/tesmi/{+page.js => +page.server.js} (97%) diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte new file mode 100644 index 0000000..3727a5e --- /dev/null +++ b/src/routes/+error.svelte @@ -0,0 +1,9 @@ + + +
+

{$page.status}-{$page.error.message}

+ Etusivulle +
diff --git a/src/routes/tesmi/+page.js b/src/routes/tesmi/+page.server.js similarity index 97% rename from src/routes/tesmi/+page.js rename to src/routes/tesmi/+page.server.js index 1c36734..c6decfd 100644 --- a/src/routes/tesmi/+page.js +++ b/src/routes/tesmi/+page.server.js @@ -3,7 +3,7 @@ export const load = async ({fetch, params }) => { if (response.ok) { const data = await response.json(); - + return { posts: data };