Remove error handler from direct axios calls, the interceptor will do the job

This commit is contained in:
Bubka
2020-01-26 21:57:53 +01:00
parent c6b7c4e495
commit 90bf333934
4 changed files with 34 additions and 38 deletions

View File

@@ -159,21 +159,17 @@
}
},
logout(evt) {
async logout(evt) {
if(confirm(this.$t('auth.confirm.logout'))) {
this.axios.get('api/logout')
.then(response => {
localStorage.removeItem('jwt');
localStorage.removeItem('user');
await this.axios.get('api/logout')
delete this.axios.defaults.headers.common['Authorization'];
localStorage.removeItem('jwt');
localStorage.removeItem('user');
this.$router.go('/login');
})
.catch(error => {
this.$router.push({ name: 'genericError', params: { err: error.response } });
});
delete this.axios.defaults.headers.common['Authorization'];
this.$router.go('/login');
}
}