Skip to content

Commit

Permalink
Create handleErrorObject.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
vhande committed Nov 22, 2024
1 parent e75554a commit 7a657e8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/utils/handleErrorObject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { ErrorObject, isErrorObject } from './fetchFromApi';

export const handleErrorObject = async (response: ErrorObject | Response) =>
// eslint-disable-next-line no-console
isErrorObject(response) ? console.error(response) : await response.json();

0 comments on commit 7a657e8

Please sign in to comment.