Skip to content

Commit

Permalink
fix: add condition for no-content http code
Browse files Browse the repository at this point in the history
  • Loading branch information
barbmarcio committed Aug 15, 2024
1 parent 2392391 commit 3923a5c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import AppError from "./app-error";

class APIClient {
private async handleResponse(response: Response): Promise<unknown> {
const data: unknown = await response.json();
let data: unknown;

if (response.status !== 204) {
data = await response.json();
}

if (!response.ok) {
const retry = response.status === 429 || response.status >= 500;
Expand Down

0 comments on commit 3923a5c

Please sign in to comment.