Fix 400 on NewBook sync and run-due: send empty JSON body
Fastify rejects POST requests that carry Content-Type: application/json
but an empty body (JSON.parse('') throws). Both no-body POSTs now send {}.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3289a31027
commit
2a3a226131
1 changed files with 2 additions and 2 deletions
|
|
@ -29,7 +29,7 @@ export function updateLocation(id: number, body: Partial<Location>): Promise<Loc
|
||||||
return request(`/locations/${id}`, { method: 'PATCH', body: JSON.stringify(body) })
|
return request(`/locations/${id}`, { method: 'PATCH', body: JSON.stringify(body) })
|
||||||
}
|
}
|
||||||
export function syncNewbookRooms(): Promise<{ ok: boolean; created: number; updated: number; total: number }> {
|
export function syncNewbookRooms(): Promise<{ ok: boolean; created: number; updated: number; total: number }> {
|
||||||
return request('/locations/sync-newbook', { method: 'POST' })
|
return request('/locations/sync-newbook', { method: 'POST', body: JSON.stringify({}) })
|
||||||
}
|
}
|
||||||
export function createCategory(body: { name: string; sort_order?: number; is_rooms?: boolean }): Promise<Category> {
|
export function createCategory(body: { name: string; sort_order?: number; is_rooms?: boolean }): Promise<Category> {
|
||||||
return request('/categories', { method: 'POST', body: JSON.stringify(body) })
|
return request('/categories', { method: 'POST', body: JSON.stringify(body) })
|
||||||
|
|
@ -193,7 +193,7 @@ export function updateTemplate(id: number, body: Record<string, unknown>): Promi
|
||||||
return request(`/templates/${id}`, { method: 'PATCH', body: JSON.stringify(body) })
|
return request(`/templates/${id}`, { method: 'PATCH', body: JSON.stringify(body) })
|
||||||
}
|
}
|
||||||
export function runDueTemplates(): Promise<{ ok: boolean; spawned: number }> {
|
export function runDueTemplates(): Promise<{ ok: boolean; spawned: number }> {
|
||||||
return request('/templates/run-due', { method: 'POST' })
|
return request('/templates/run-due', { method: 'POST', body: JSON.stringify({}) })
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config
|
// Config
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue