diff --git a/frontend/src/data/fetchWithToken.ts b/frontend/src/data/fetchWithToken.ts index 6e680f9b..f817c3e1 100644 --- a/frontend/src/data/fetchWithToken.ts +++ b/frontend/src/data/fetchWithToken.ts @@ -29,11 +29,16 @@ export async function fetchWithToken(path: string): Promise { method: "GET", headers: headers, }; + + const completeUrl = `${apiBackendUrl}/${path}`; + try { - const response = await fetch(`${apiBackendUrl}/${path}`, options); - return (await response.json()) as T; + const response = await fetch(completeUrl, options); + const json = await response.json(); + return json as T; } catch (e) { console.error(e); + throw new Error(`${options.method} ${completeUrl} failed`); } }