mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 18:13:31 +00:00
attempt to catch network errors to prevent credential invalidation
This commit is contained in:
parent
e5adc0caa9
commit
08fc307516
1 changed files with 13 additions and 2 deletions
|
|
@ -349,7 +349,14 @@ axiosClient.interceptors.response.use(
|
|||
.catch((newError: any) => {
|
||||
if (newError !== TIMEOUT_ERROR) {
|
||||
console.error('Error when trying to reauthenticate: ', newError);
|
||||
limitedFail(currentServer);
|
||||
|
||||
if (isAxiosError(newError) && newError.code === 'ERR_NETWORK') {
|
||||
console.log(
|
||||
'Network error during reauthentication - preserving credentials',
|
||||
);
|
||||
} else {
|
||||
limitedFail(currentServer);
|
||||
}
|
||||
}
|
||||
|
||||
// make sure to pass the error so axios will error later on
|
||||
|
|
@ -360,7 +367,11 @@ axiosClient.interceptors.response.use(
|
|||
});
|
||||
}
|
||||
|
||||
limitedFail(currentServer);
|
||||
if (isAxiosError(error) && error.code === 'ERR_NETWORK') {
|
||||
console.log('Network error during authentication - preserving credentials');
|
||||
} else {
|
||||
limitedFail(currentServer);
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue