From b7f6dfb8ad5414d89ed52deb13c79d0f72183cae Mon Sep 17 00:00:00 2001 From: Hel Nershing Thapa Date: Fri, 4 Aug 2023 14:18:37 +0545 Subject: [PATCH] Don't retry for 401 and 403 status codes --- frontend/src/App.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/src/App.js b/frontend/src/App.js index 6b409af27b..6043b0deb3 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -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; + }, }, }, });