mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-10 10:21:55 +00:00
Improve handling when bot is down
This commit is contained in:
parent
a0ca9f6793
commit
c5eadc3d3d
|
@ -30,8 +30,7 @@ api.interceptors.response.use(
|
|||
console.log('Dispatching refresh_token...');
|
||||
userService.refreshToken();
|
||||
// maybe redirect to /login if needed !
|
||||
}
|
||||
if (err.response && err.response.status === 500) {
|
||||
} else if (err.response && err.response.status === 500) {
|
||||
console.log('Bot seems to be offline...');
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
|
@ -63,10 +63,14 @@ export default {
|
|||
this.setAccessToken(result.data.access_token);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
// in case of errors when using the refresh token - logout.
|
||||
this.logout();
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
if (err.response && err.response.status === 401) {
|
||||
// in case of errors when using the refresh token - logout.
|
||||
this.logout();
|
||||
} else if (err.response && (err.response.status === 500 || err.response.status === 404)) {
|
||||
console.log('Bot seems to be offline... - retrying later');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user