Barazo default frontend barazo.forum

fix(api): handle 204 No Content responses in apiFetch (#193)

DELETE endpoints (like unlike/reaction delete) return 204 with empty body.
apiFetch was unconditionally calling response.json(), causing
"JSON.parse: unexpected end of data" errors.

authored by

Guido X Jansen and committed by
GitHub
4cdf15df 9bfa4827

+4
+4
src/lib/api/client.ts
··· 139 139 await throwApiError(response) 140 140 } 141 141 142 + if (response.status === 204) { 143 + return undefined as T 144 + } 145 + 142 146 return response.json() as Promise<T> 143 147 } 144 148