Skip to content

Commit

Permalink
204レスポンスの時レスポンスを見ない
Browse files Browse the repository at this point in the history
  • Loading branch information
tohutohu committed Dec 7, 2024
1 parent 3ecc7ad commit 30c6faf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions frontend/app/api/api-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ export async function apiFetch<
throw error;
}

if (response.status === 204) {
return undefined as unknown as TData;
}

if (response.headers.get("content-type")?.includes("json")) {
return await response.json();
} else {
Expand Down

0 comments on commit 30c6faf

Please sign in to comment.