diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.ts index 05da8b43..e4a2a889 100644 --- a/apps/web/src/lib/api.ts +++ b/apps/web/src/lib/api.ts @@ -82,10 +82,12 @@ export async function apiGet(path: string): Promise { } export async function apiPost(path: string, body?: unknown): Promise { + const headers = + body !== undefined ? formatHeaders({ "Content-Type": "application/json" }) : formatHeaders(); const res = await fetch(`${API_BASE}${path}`, { method: "POST", - headers: formatHeaders({ "Content-Type": "application/json" }), - body: body ? JSON.stringify(body) : undefined, + headers, + body: body !== undefined ? JSON.stringify(body) : undefined, }); if (!res.ok) await throwWithMessage(res); return res.json();