|
@@ -48,7 +48,8 @@ const actions = {
|
|
getInfo({ commit, state }) {
|
|
getInfo({ commit, state }) {
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
getInfo(state.token).then(response => {
|
|
getInfo(state.token).then(response => {
|
|
- const { data } = response
|
|
|
|
|
|
+ // const { data } = response
|
|
|
|
+ const data = response.data
|
|
if (!data) {
|
|
if (!data) {
|
|
reject('Verification failed, please Login again.')
|
|
reject('Verification failed, please Login again.')
|
|
}
|
|
}
|
|
@@ -56,17 +57,14 @@ const actions = {
|
|
if (!roles || roles.length <= 0) {
|
|
if (!roles || roles.length <= 0) {
|
|
reject('getInfo: roles must be a non-null array!')
|
|
reject('getInfo: roles must be a non-null array!')
|
|
} */
|
|
} */
|
|
- const account = data.account
|
|
|
|
- const roles = ['admin']
|
|
|
|
- const introduction = 'I am a super administrator'
|
|
|
|
- const avatar = 'avatar'
|
|
|
|
-
|
|
|
|
|
|
+ data.roles = ['admin']
|
|
|
|
+ data.introduction = 'I am a super administrator'
|
|
|
|
+ const { roles, account, avatar, introduction } = data
|
|
commit('SET_ROLES', roles)
|
|
commit('SET_ROLES', roles)
|
|
commit('SET_NAME', account)
|
|
commit('SET_NAME', account)
|
|
commit('SET_AVATAR', avatar)
|
|
commit('SET_AVATAR', avatar)
|
|
commit('SET_INTRODUCTION', introduction)
|
|
commit('SET_INTRODUCTION', introduction)
|
|
resolve(data)
|
|
resolve(data)
|
|
- debugger
|
|
|
|
}).catch(error => {
|
|
}).catch(error => {
|
|
reject(error)
|
|
reject(error)
|
|
})
|
|
})
|