Skip to content

Commit

Permalink
Don't retry for 401 and 403 status codes
Browse files Browse the repository at this point in the history
  • Loading branch information
HelNershingThapa committed Aug 4, 2023
1 parent 0ddc26c commit b7f6dfb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
retry: (failureCount, error) => {
// Don't retry for 401 or 403 errors
const maxRetries = 3;
if (error?.response?.status) {
const statusCode = error.response.status;
if (statusCode === 401 || statusCode === 403) {
return false;
}
}
return failureCount < maxRetries;
},
},
},
});
Expand Down

0 comments on commit b7f6dfb

Please sign in to comment.