Fix POST without body: only set Content-Type when body present

This commit is contained in:
jtricerolph 2026-07-23 09:10:55 +00:00
parent 32318aa63f
commit fc92bcd897

View file

@ -3,9 +3,10 @@ import type { DeptActuals, DeptScheduled, NetSalesDay, WageBudget, AppSetting }
const BASE = '/wages/api'
async function request<T>(path: string, opts: RequestInit = {}): Promise<T> {
const headers: Record<string, string> = opts.body != null ? { 'Content-Type': 'application/json' } : {}
const res = await fetch(`${BASE}${path}`, {
credentials: 'include',
headers: { 'Content-Type': 'application/json', ...opts.headers },
headers: { ...headers, ...opts.headers },
...opts,
})
if (res.status === 401) {