两次提交

This commit is contained in:
caoqianming 2021-03-18 15:22:54 +08:00
parent 275d1c96e7
commit 6bd5cf1365
2 changed files with 23 additions and 10 deletions

View File

@ -19,11 +19,11 @@
首页
</el-dropdown-item>
</router-link>
<router-link to="/myinfo">
<!-- <router-link to="/myinfo">
<el-dropdown-item divided>
个人中心
</el-dropdown-item>
</router-link>
</router-link> -->
<!-- <a target="_blank" href="https://github.com/PanJiaChen/vue-admin-template/">
<el-dropdown-item>Github</el-dropdown-item>
</a>

View File

@ -95,16 +95,29 @@ const actions = {
return new Promise((resolve, reject) => {
getInfo(state.token).then(response => {
const { data } = response
const { perms, name, avatar } = data
// perms must be a non-empty array
if (!perms || perms.length <= 0) {
reject('没有任何权限!')
if(data){
const { perms, name, avatar } = data
// perms must be a non-empty array
if (!perms || perms.length <= 0) {
reject('没有任何权限!')
}
commit('SET_PERMS', perms)
commit('SET_NAME', name)
commit('SET_AVATAR', avatar)
resolve(data)
}else{
getInfo(state.token).then(res=>{
const { data } = response
if (!perms || perms.length <= 0) {
reject('没有任何权限!')
}
commit('SET_PERMS', perms)
commit('SET_NAME', name)
commit('SET_AVATAR', avatar)
resolve(data)
})
}
commit('SET_PERMS', perms)
commit('SET_NAME', name)
commit('SET_AVATAR', avatar)
resolve(data)