Update error def
Some checks failed
ci/woodpecker/push/build Pipeline failed

This commit is contained in:
Alessio Davoli 2024-03-06 00:10:33 +01:00
parent fe9a3f3f25
commit 9d0dbc520b
2 changed files with 10 additions and 12 deletions

View file

@ -4,7 +4,6 @@ declare global {
namespace App {
export interface Error {
message: string;
errorId: string;
}
// interface Locals {}
// interface PageData {}

View file

@ -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 };
}
return { categories };
}