fix(todos): handleResponse gère 204 No Content (suppression sans SyntaxError)
This commit is contained in:
@@ -53,6 +53,7 @@ const BASE = '/api/todos'
|
||||
|
||||
async function handleResponse<T>(res: Response): Promise<T> {
|
||||
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`)
|
||||
if (res.status === 204) return undefined as T
|
||||
return res.json() as Promise<T>
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user