fix: handle empty 200 responses in adminFetch to fix stale UI after mutations

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-03-17 19:04:41 +01:00
parent 9d08e74913
commit 48b17f83a3

View File

@@ -18,5 +18,7 @@ export async function adminFetch<T>(path: string, options?: RequestInit): Promis
}
if (!res.ok) throw new Error(`API error: ${res.status}`);
if (res.status === 204) return undefined as T;
return res.json();
const text = await res.text();
if (!text) return undefined as T;
return JSON.parse(text);
}