Fixes response for protected API routes

This commit is contained in:
Christian Beutel
2025-09-19 15:11:09 +02:00
parent 5580832675
commit cf74a711e9
2 changed files with 10 additions and 5 deletions

View File

@@ -2,9 +2,9 @@ import type { Trail } from "$lib/models/trail";
import { categories_index } from "$lib/stores/category_store";
import { feed_index } from "$lib/stores/feed_store";
import { trails_recommend } from "$lib/stores/trail_store";
import type { ServerLoad } from "@sveltejs/kit";
import type { Load } from "@sveltejs/kit";
export const load: ServerLoad = async ({ params, locals, fetch }) => {
export const load: Load = async ({ fetch }) => {
try {
await categories_index(fetch)
@@ -14,7 +14,9 @@ export const load: ServerLoad = async ({ params, locals, fetch }) => {
return { trails: trails ?? [], feed }
} catch (e) {
console.error(e)
if (!(e instanceof Error) || e.message !== "Unauthorized") {
console.error(e)
}
}
return { trails: [], feed: {items: [], page: 1, perPage: 1, totalItems: 0, totalPages: 0} }
return { trails: [], feed: { items: [], page: 1, perPage: 1, totalItems: 0, totalPages: 0 } }
};