优化
This commit is contained in:
parent
e40534e1fc
commit
c87b50cceb
@ -26,6 +26,7 @@ const user = {
|
|||||||
actions: {
|
actions: {
|
||||||
GET_USERINFO: async ({ commit }) => {
|
GET_USERINFO: async ({ commit }) => {
|
||||||
let res = await apiUserInfo()
|
let res = await apiUserInfo()
|
||||||
|
console.log('GET_USERINFO: ', res)
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
commit('SET_USER_INFO', res.user)
|
commit('SET_USER_INFO', res.user)
|
||||||
commit('SET_USER_AUTH', res.data)
|
commit('SET_USER_AUTH', res.data)
|
||||||
|
|||||||
@ -42,8 +42,13 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
let res = await handleGetDingtalkCode()
|
let res = await handleGetDingtalkCode()
|
||||||
console.log('res: ', res)
|
console.log('res: ', res)
|
||||||
if (res === 1) {
|
if (res === 1) {
|
||||||
|
console.log('res: ', res)
|
||||||
let res1 = await store.dispatch('GET_USERINFO')
|
let res1 = await store.dispatch('GET_USERINFO')
|
||||||
|
console.log('res1: ', res1)
|
||||||
if (res1 === 1) next()
|
if (res1 === 1) next()
|
||||||
|
} else {
|
||||||
|
this.$message.error('网络错误')
|
||||||
|
next()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
next()
|
next()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user