diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/router/index.js | 3 | ||||
-rw-r--r-- | src/store/api.js | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/router/index.js b/src/router/index.js index 33743fe0..c3d44390 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -98,9 +98,6 @@ const router = new VueRouter({ }); router.beforeEach((to, from, next) => { - // Commit logout to remove XSRF-TOKEN cookie when - // redirected to login page (eg 401 response) - if (to.name === 'login') store.commit('authentication/logout'); if (to.matched.some(record => record.meta.requiresAuth)) { if (store.getters['authentication/isLoggedIn']) { next(); diff --git a/src/store/api.js b/src/store/api.js index 24a38e4b..c8f1edae 100644 --- a/src/store/api.js +++ b/src/store/api.js @@ -1,5 +1,6 @@ import Axios from 'axios'; import router from '../router'; +import store from '@/store'; const api = Axios.create({ withCredentials: true @@ -12,6 +13,8 @@ api.interceptors.response.use(undefined, error => { if (response.status == 401) { if (response.config.url != '/login') { window.location = '/login'; + // Commit logout to remove XSRF-TOKEN cookie + store.commit('authentication/logout'); } } |