diff --git a/src/lib/scripts/apiFetch.ts b/src/lib/scripts/apiFetch.ts index ba9ce53..972d077 100644 --- a/src/lib/scripts/apiFetch.ts +++ b/src/lib/scripts/apiFetch.ts @@ -34,8 +34,12 @@ export async function apiGet(path: string): Promise { try { const res = await fetch(getUrlString() + path, options); + if (res.status === 401) { + throw new Error("Registration not accepted. Register at `Menu > Registration`"); + } + if (!res.ok) { - throw new Error("Network response not ok"); + throw new Error(`Failed: ${res.status}: ${res.statusText}`); } const contentType = res.headers.get("content-type"); if (!contentType || !contentType.includes("application/json")) {