添加socket的userId

This commit is contained in:
熊丽君
2021-08-17 10:09:38 +08:00
parent bff46269db
commit af6cafafec
3 changed files with 7 additions and 4 deletions

View File

@ -5,6 +5,7 @@ const user = {
state: {
token: getToken(),
name: '',
userId: '',
avatar: '',
roles: [],
permissions: []
@ -17,6 +18,10 @@ const user = {
SET_NAME: (state, name) => {
state.name = name;
},
SET_USER_ID: (state, userId) => {
state.userId = userId;
localStorage.setItem('userId', userId);
},
SET_AVATAR: (state, avatar) => {
state.avatar = avatar;
},
@ -81,6 +86,7 @@ const user = {
commit('SET_ROLES', ['ROLE_DEFAULT']);
}
commit('SET_NAME', user.username);
commit('SET_USER_ID', user.userId);
commit('SET_AVATAR', avatar);
resolve(res);
})