diff --git a/src/utils/store.js b/src/utils/store.js index 3ba2ce9f..85f2cb25 100644 --- a/src/utils/store.js +++ b/src/utils/store.js @@ -8,24 +8,17 @@ import extra from "../config.json" Vue.use(Vuex) export default new Vuex.Store({ - state: { - }, + state: {}, mutations: { signOut(state, flag) { const base = extra.base || "" - if (flag) { - state.user.token = null; - state.user.info = {} + new Promise(resolve => { + flag ? resolve() : axios.delete('/auth/token/logout').then(resolve) + }).then(() => { + localStorage.removeItem("vuex"); sessionStorage.clear(); - location.href = base + '/login' + location.hash; - } else { - axios.delete('/auth/token/logout').then(() => { - state.user.token = null; - sessionStorage.clear(); - state.user.info = {} - location.href = base + '/login'; - }); - } + location.href = [base, '/login', location.hash].join(''); + }) }, }, getters: {