fix: 登录页面和退出的问题

This commit is contained in:
cgd_mac 2022-02-23 19:20:24 +08:00
parent 0ca808cf94
commit fa29c41314
2 changed files with 16 additions and 9 deletions

View File

@ -3,7 +3,7 @@
<div class="container">
<div class="top">
<div class="header">
<a href="/">
<a href="javascript:void(0);">
<img src="~@/assets/logo.svg" class="logo" alt="logo">
<span class="title">安全培训平台</span>
</a>

View File

@ -78,16 +78,23 @@ const user = {
// 登出
Logout ({ commit, state }) {
return new Promise((resolve) => {
logout().then(() => {
resolve()
}).catch(() => {
resolve()
}).finally(() => {
const clear = function () {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
commit('SET_BUTTONS', [])
commit('SET_ROUTERS', [])
storage.remove(ACCESS_TOKEN)
}
logout().then(() => {
clear()
setTimeout(() => {
resolve()
}, 300)
resolve()
}).catch(() => {
resolve()
}).finally(() => {
clear()
})
})
}