There was an error while loading. Please reload this page.
1 parent aefda53 commit 1da2e53Copy full SHA for 1da2e53
1 file changed
frontend/src/api/api.ts
@@ -63,11 +63,13 @@ async function apiRequest<Model extends z.ZodTypeAny>(
63
64
const body = init.body ?? (init.json !== undefined ? JSON.stringify(init.json) : undefined);
65
66
- const headers = {
+ const headers: Record<string, string> = {
67
"Content-Type": "application/json",
68
- Authorization: `Bearer ${token}`,
69
- ...(init.headers ?? {}),
+ ...Object.fromEntries(new Headers(init.headers as HeadersInit)),
70
};
+ if (token) {
71
+ headers["Authorization"] = `Bearer ${token}`;
72
+ }
73
74
const response = await fetch(url, {
75
...init,
0 commit comments