Fix error when there is no network connection

This commit is contained in:
Marco Realacci 2022-12-15 14:22:28 +01:00
parent 8613a5780f
commit 92522876b7
4 changed files with 40 additions and 34 deletions

View file

@ -26,20 +26,20 @@ export default {
// Leave response as is
return response;
}, error => {
if (error.response != undefined) {
if (error.response.status != 0) {
// If the response is 401, redirect to /login
if (error.response.status === 401) {
this.$router.push({ path: '/login' })
return
return;
}
// Show the error message from the server in a modal
this.showModal("Error " + error.response.status, error.response.data['status'])
return
return;
}
// Show the error message from axios in a modal
this.showModal("Error", error.toString());
return error;
return;
});
}
}