diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/AppHeader/AppHeader.vue | 4 | ||||
-rw-r--r-- | src/store/modules/Authentication/AuthenticanStore.js | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/components/AppHeader/AppHeader.vue b/src/components/AppHeader/AppHeader.vue index b2d29c95..880c428f 100644 --- a/src/components/AppHeader/AppHeader.vue +++ b/src/components/AppHeader/AppHeader.vue @@ -66,9 +66,7 @@ export default { this.$store.dispatch('global/getHostStatus'); }, logout() { - this.$store.dispatch('authentication/logout').then(() => { - this.$router.push('/login'); - }); + this.$store.dispatch('authentication/logout'); } } }; diff --git a/src/store/modules/Authentication/AuthenticanStore.js b/src/store/modules/Authentication/AuthenticanStore.js index 8d8898ef..975f258b 100644 --- a/src/store/modules/Authentication/AuthenticanStore.js +++ b/src/store/modules/Authentication/AuthenticanStore.js @@ -1,5 +1,6 @@ import api from '../../api'; import Cookies from 'js-cookie'; +import router from '../../../router'; const AuthenticationStore = { namespaced: true, @@ -19,8 +20,7 @@ const AuthenticationStore = { authError(state) { state.authError = true; }, - logout(state) { - state.authError = false; + logout() { Cookies.remove('XSRF-TOKEN'); } }, @@ -38,6 +38,7 @@ const AuthenticationStore = { api .post('/logout', { data: [] }) .then(() => commit('logout')) + .then(() => router.go('/login')) .catch(error => console.log(error)); } } |