Fixes response for protected API routes
This commit is contained in:
@@ -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 } }
|
||||
};
|
||||
Reference in New Issue
Block a user