Commit 3551c2a7 authored by wangxl's avatar wangxl

33

parent bd2a02e7
......@@ -317,17 +317,12 @@ export function changeSystemType (type) {
try {
this.$store.commit('app/clearStore')
setType(type + '')
await store.dispatch('user/getMenuList')
await store.dispatch('user/logout')
this.$store.commit('app/setSystemType', type)
this.$router.push('/')
resolve(true)
} catch (e) {
this.$api.base.logout().then(({ data }) => { }).catch(() => { })
removeToken()
window.sessionStorage.clear();
this.$store.commit('app/clearStore')
this.$router.push(`/login`)
reject(false)
store.dispatch('user/logout')
}
})
}
......
// @ts-nocheck
import router from '@/router'
import api from '@/api'
import { getType } from '@/views/utils/auth'
import { getToken, removeToken, getType, setType } from '@/views/utils/auth'
const state = {
......@@ -50,6 +50,16 @@ const actions = {
})
})
},
logout ({ dispatch }) {
return new Promise(async (resolve, reject) => {
this.$message.error('登录信息失效,请重新登录!')
this.$api.base.logout().then(({ data }) => { }).catch(() => { })
removeToken()
window.sessionStorage.clear()
this.$store.commit('app/clearStore')
this.$router.push(`/login`)
})
},
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment