登录页面增加登出接口

This commit is contained in:
aixianling
2022-06-10 16:24:29 +08:00
parent 1218536e64
commit 2c9f3179c1
2 changed files with 9 additions and 1 deletions

View File

@@ -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)

View File

@@ -24,6 +24,7 @@ const store = new Vuex.Store({
logout(state) {
state.token = ""
state.openUser = {}
state.user = {}
},
setOpenUser(state, user) {
state.openUser = user