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:
@@ -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.ok) throw new Error(`API error: ${res.status}`);
|
||||||
if (res.status === 204) return undefined as T;
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user