登录页面增加登出接口
This commit is contained in:
@@ -47,7 +47,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getToken']),
|
||||
...mapMutations(['login']),
|
||||
...mapMutations(['login', 'logout']),
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validate(v => {
|
||||
if (v) {
|
||||
@@ -65,6 +65,13 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
handleLogout() {
|
||||
this.logout()
|
||||
this.$http.delete("/auth/token/logout")
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.handleLogout()
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.loginForm.setRules(this.rules)
|
||||
|
||||
@@ -24,6 +24,7 @@ const store = new Vuex.Store({
|
||||
logout(state) {
|
||||
state.token = ""
|
||||
state.openUser = {}
|
||||
state.user = {}
|
||||
},
|
||||
setOpenUser(state, user) {
|
||||
state.openUser = user
|
||||
|
||||
Reference in New Issue
Block a user