修改分模块
This commit is contained in:
@@ -9,7 +9,6 @@ const state = {
|
||||
avatar: '',
|
||||
introduction: '',
|
||||
roles: [],
|
||||
menus: [],
|
||||
username: Cookies.get('username') || ''
|
||||
}
|
||||
|
||||
@@ -26,9 +25,6 @@ const mutations = {
|
||||
SET_AVATAR: (state, avatar) => {
|
||||
state.avatar = avatar
|
||||
},
|
||||
SET_MENUS: (state, menus) => {
|
||||
state.menus = menus
|
||||
},
|
||||
SET_ROLES: (state, roles) => {
|
||||
state.roles = roles
|
||||
},
|
||||
@@ -70,17 +66,16 @@ const actions = {
|
||||
reject('Verification failed, please Login again.')
|
||||
}
|
||||
|
||||
const { roles, name, avatar, introduction, menus } = data
|
||||
const { roles, name, avatar, introduction } = data
|
||||
|
||||
// roles must be a non-empty array
|
||||
if (!menus || menus.length <= 0) {
|
||||
reject('getInfo: menus must be a non-null array!')
|
||||
if (!roles || roles.length <= 0) {
|
||||
reject('getInfo: roles must be a non-null array!')
|
||||
}
|
||||
|
||||
commit('SET_ROLES', roles || [])
|
||||
commit('SET_ROLES', roles)
|
||||
commit('SET_NAME', name)
|
||||
commit('SET_AVATAR', avatar)
|
||||
commit('SET_MENUS', menus)
|
||||
commit('SET_INTRODUCTION', introduction)
|
||||
resolve(data)
|
||||
}).catch(error => {
|
||||
@@ -97,7 +92,6 @@ const actions = {
|
||||
dispatch('tagsView/delAllViews', null, { root: true })
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_ROLES', [])
|
||||
commit('SET_MENUS', [])
|
||||
commit('SET_USERNAME')
|
||||
Cookies.set('username', '')
|
||||
localStorage.clear()
|
||||
|
||||
Reference in New Issue
Block a user