From 2a3a2261316652c705e411401486ae984800c80f Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Wed, 8 Jul 2026 11:10:14 +0000 Subject: [PATCH] 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 --- frontend/src/api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/api.ts b/frontend/src/api.ts index e1cc551..d264c47 100644 --- a/frontend/src/api.ts +++ b/frontend/src/api.ts @@ -29,7 +29,7 @@ export function updateLocation(id: number, body: Partial): Promise { - 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 { return request('/categories', { method: 'POST', body: JSON.stringify(body) }) @@ -193,7 +193,7 @@ export function updateTemplate(id: number, body: Record): Promi return request(`/templates/${id}`, { method: 'PATCH', body: JSON.stringify(body) }) } 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