I'm using axios-retry to detec if there is no internet connection, once the axios request fails due to the network i have this running.
axiosRetry(axios, {
retries: 5, // number of retries
retryDelay: (retryCount) => {
console.log(`retry attempt: ${retryCount}`);
return retryCount * 5000; // time interval between retries
},
retryCondition: axiosRetry.isRetryableError
});
Is it possible to run handleLogout() (which logout the user); only if it reached the maximum retries of 5? and then stop retrying the others axios that would fail at the meantime?
I believe that you can just catch the error which will only happen if retry attempt exceed the max.
for example,