|
|
@ -4,6 +4,7 @@ import { getToken, setToken, removeToken } from '@/utils/auth'
|
|
|
|
const user = {
|
|
|
|
const user = {
|
|
|
|
state: {
|
|
|
|
state: {
|
|
|
|
token: getToken(),
|
|
|
|
token: getToken(),
|
|
|
|
|
|
|
|
id: '',
|
|
|
|
name: '',
|
|
|
|
name: '',
|
|
|
|
avatar: '',
|
|
|
|
avatar: '',
|
|
|
|
roles: [],
|
|
|
|
roles: [],
|
|
|
@ -14,6 +15,9 @@ const user = {
|
|
|
|
SET_TOKEN: (state, token) => {
|
|
|
|
SET_TOKEN: (state, token) => {
|
|
|
|
state.token = token
|
|
|
|
state.token = token
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
SET_ID: (state, id) => {
|
|
|
|
|
|
|
|
state.id = id
|
|
|
|
|
|
|
|
},
|
|
|
|
SET_NAME: (state, name) => {
|
|
|
|
SET_NAME: (state, name) => {
|
|
|
|
state.name = name
|
|
|
|
state.name = name
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -58,6 +62,7 @@ const user = {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
commit('SET_ROLES', ['ROLE_DEFAULT'])
|
|
|
|
commit('SET_ROLES', ['ROLE_DEFAULT'])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
commit('SET_ID', user.userId)
|
|
|
|
commit('SET_NAME', user.userName)
|
|
|
|
commit('SET_NAME', user.userName)
|
|
|
|
commit('SET_AVATAR', avatar)
|
|
|
|
commit('SET_AVATAR', avatar)
|
|
|
|
resolve(res)
|
|
|
|
resolve(res)
|
|
|
|