退出登录

This commit is contained in:
jiutianzhiyu 2021-03-25 23:39:57 +08:00
parent afb4daf19d
commit 3c0491662d
2 changed files with 9 additions and 1 deletions

View File

@ -51,9 +51,12 @@ export default {
toggleSideBar() { toggleSideBar() {
this.$store.dispatch('app/toggleSideBar') this.$store.dispatch('app/toggleSideBar')
}, },
// 退
async logout() { async logout() {
// vuextoken, userinfo
await this.$store.dispatch('user/logout') await this.$store.dispatch('user/logout')
this.$router.push(`/login?redirect=${this.$route.fullPath}`) //
this.$router.push('/login')
} }
} }
} }

View File

@ -150,6 +150,11 @@ const actions = {
} }
commit('setUserInfo', totalInfo) commit('setUserInfo', totalInfo)
return totalInfo return totalInfo
},
// 退出登录
logout(contex) {
contex.commit('removeToken')
contex.commit('removeUserInfo')
} }
} }