From 9d0dbc520bce4645dbbf92bf6f2cb1a455e67e9c Mon Sep 17 00:00:00 2001 From: Alessio Davoli Date: Wed, 6 Mar 2024 00:10:33 +0100 Subject: [PATCH] Update error def --- frontend/src/app.d.ts | 1 - frontend/src/routes/+page.ts | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/frontend/src/app.d.ts b/frontend/src/app.d.ts index f475253..77f1626 100644 --- a/frontend/src/app.d.ts +++ b/frontend/src/app.d.ts @@ -4,7 +4,6 @@ declare global { namespace App { export interface Error { message: string; - errorId: string; } // interface Locals {} // interface PageData {} diff --git a/frontend/src/routes/+page.ts b/frontend/src/routes/+page.ts index c642531..2bb37d4 100644 --- a/frontend/src/routes/+page.ts +++ b/frontend/src/routes/+page.ts @@ -1,17 +1,16 @@ - import { error } from '@sveltejs/kit'; -import {PUBLIC_BACKEND_URL} from '$env/static/public'; +import { PUBLIC_BACKEND_URL } from '$env/static/public'; const API_URL = `${PUBLIC_BACKEND_URL}/api`; export async function load({ fetch }) { - let categories = []; - try { - const response = await fetch(`${API_URL}/route-categories`); - categories = await response.json(); - } catch (ex) { - error(404, "API Not Found"); - } + let categories = []; + try { + const response = await fetch(`${API_URL}/route-categories`); + categories = await response.json(); + } catch (ex) { + error(404, { message: 'API Not Found'}); + } - return { categories }; -} \ No newline at end of file + return { categories }; +}