bugfix :: sync room > userinfo

This commit is contained in:
leejinho 2020-02-18 10:16:10 +09:00
parent 87cbb1b6b5
commit 40298cdba2

View File

@ -223,50 +223,55 @@ export class Effects {
case SSVC_TYPE_SYNC_ROOM_USER:
{
const roomUserData = res as RoomUserData;
if (
roomList.length > 0 &&
roomList.filter(r => r.roomSeq === roomUserData.roomSeq)
.length > 0
) {
if (!roomUserInfoMap[roomUserData.roomSeq]) {
roomUserInfoMap[roomUserData.roomSeq] = {
userInfoList: [],
userInfoShortList: []
};
}
roomUserInfoMap[
roomUserData.roomSeq
].userInfoShortList.push(...roomUserData.userInfos);
if (!roomUserInfoMap[roomUserData.roomSeq]) {
roomUserInfoMap[roomUserData.roomSeq] = {
userInfoList: [],
userInfoShortList: []
};
}
roomUserInfoMap[
roomUserData.roomSeq
].userInfoShortList.push(...roomUserData.userInfos);
}
break;
case SSVC_TYPE_SYNC_ROOM_USER2:
{
const roomUserDetailData = res as RoomUserDetailData;
if (
roomList.length > 0 &&
roomList.filter(
r => r.roomSeq === roomUserDetailData.roomSeq
).length > 0
) {
if (!roomUserInfoMap[roomUserDetailData.roomSeq]) {
roomUserInfoMap[roomUserDetailData.roomSeq] = {
userInfoList: [],
userInfoShortList: []
};
}
roomUserInfoMap[
roomUserDetailData.roomSeq
].userInfoList.push(...roomUserDetailData.userInfos);
if (!roomUserInfoMap[roomUserDetailData.roomSeq]) {
roomUserInfoMap[roomUserDetailData.roomSeq] = {
userInfoList: [],
userInfoShortList: []
};
}
roomUserInfoMap[
roomUserDetailData.roomSeq
].userInfoList.push(...roomUserDetailData.userInfos);
}
break;
case SSVC_TYPE_SYNC_ROOM_RES:
{
const tmpRoomUserInfoMap: {
[param: string]: {
userInfoShortList: UserInfoShort[];
userInfoList: RoomUserInfo[];
};
} = {};
roomList.forEach(roomInfo => {
for (const key in roomUserInfoMap) {
if (
key === roomInfo.roomSeq &&
roomUserInfoMap.hasOwnProperty(key)
) {
tmpRoomUserInfoMap[key] = roomUserInfoMap[key];
}
}
});
this.store.dispatch(
roomSuccess({
roomList,
roomUserInfoMap,
roomUserInfoMap: tmpRoomUserInfoMap,
syncDate: (res as RoomResponse).syncDate
})
);