Commit c637236e by YuleiLan

fix: 修复循环获取用户信息的bug, fix #150

parent 888b6bfc
......@@ -78,8 +78,10 @@ const actions = {
commit('SET_AVATAR', avatar)
commit('SET_INTRODUCTION', introduction)
resolve(response)
}).catch(error => {
reject(error)
}).catch(() => {
commit('SET_TOKEN', '')
setToken('')
router.push({ path: '/' })
})
})
},
......
import axios from 'axios'
import { Notification, MessageBox, Message } from 'element-ui'
import { MessageBox, Message } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/auth'
......@@ -74,18 +74,13 @@ service.interceptors.response.use(
location.reload() // 为了重新实例化vue-router对象 避免bug
})
return false
} else if (code === 400 || code === 403) {
} else if (code === 400 || code === 403 || code !== 200) {
Message({
message: response.data.msg,
type: 'error',
duration: 5 * 1000
})
return Promise.reject('error')
} else if (code !== 200) {
Notification.error({
title: response.data.msg
})
return Promise.reject('error')
} else {
return response.data
}
......
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 sign in to comment