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