Commit 1759f620 by 段启岩

修复用户登录后出现在别人电脑上的问题

parent 9314cbaa
......@@ -17,7 +17,6 @@ export const actions = {
} catch (e) {
// 请求出错,删除认证信息
commit('auth/logout')
console.log(e)
}
}
}
......
......@@ -3,27 +3,21 @@ const defaultUser = {
nickName: null,
avatar: null
}
export const state = () => defaultUser
export const state = () => ({
... defaultUser
})
export const mutations = {
setUser (state, user) {
if(user.userId){
Object.assign(state, {
userId: user.userId,
})
}
if(user.userAvatar){
Object.assign(state, {
avatar: user.userAvatar,
})
}
if(user.nickName){
Object.assign(state, {
nickName: user.nickName
})
}
Object.assign(state, {
userId: user.userId,
nickName: user.nickName,
avatar: user.avatar
})
},
removeUser (state) {
Object.assign(state, defaultUser)
Object.assign(state, {
... defaultUser
})
}
}
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 to comment