Skip to content

Commit

Permalink
refactor: simplify error handling in queryClient retry function (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
typeWolffo authored Nov 5, 2024
1 parent 164b4b2 commit 3af1b3f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions apps/web/app/api/queryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,23 @@ export const queryClient = new QueryClient({
retry(failureCount, error: unknown) {
if (isCancel(error)) return false;

if (isAxiosError(error)) {
if (error.response?.status === 401) return false;
}
if (isAxiosError(error) && error.response) return false;

if (failureCount >= 3) return false;

return true;
},
throwOnError: (error) => !isCancel(error),
},
mutations: {
retry(failureCount, error: unknown) {
if (isCancel(error)) return false;

if (isAxiosError(error)) {
if (error.response?.status === 401) return false;
}
if (isAxiosError(error) && error.response) return false;

if (failureCount >= 3) return false;

return true;
},
throwOnError: (error) => !isCancel(error),
},
},
});

0 comments on commit 3af1b3f

Please sign in to comment.