diff --git a/frontend/src/routes/(authenticated)/history/+page.ts b/frontend/src/routes/(authenticated)/history/+page.ts index caf95666..818257fe 100644 --- a/frontend/src/routes/(authenticated)/history/+page.ts +++ b/frontend/src/routes/(authenticated)/history/+page.ts @@ -2,13 +2,18 @@ import type { Commit } from '$lib/history'; import type { PageLoad } from './$types'; export const load = (async ({ fetch }) => { - const response = await fetch(`/api/history`, { + const history_response = fetch(`/api/history`, { method: 'GET', headers: { 'content-type': 'application/json' } + }).then((res) => { + if (!res.ok) { + throw new Error(`Failed to fetch history: ${res.status} ${res.statusText}`); + } + return res.json() as Promise; }); return { - history: response.json() as Promise + history: history_response }; }) satisfies PageLoad;