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,11 +223,6 @@ export class Effects {
case SSVC_TYPE_SYNC_ROOM_USER: case SSVC_TYPE_SYNC_ROOM_USER:
{ {
const roomUserData = res as RoomUserData; const roomUserData = res as RoomUserData;
if (
roomList.length > 0 &&
roomList.filter(r => r.roomSeq === roomUserData.roomSeq)
.length > 0
) {
if (!roomUserInfoMap[roomUserData.roomSeq]) { if (!roomUserInfoMap[roomUserData.roomSeq]) {
roomUserInfoMap[roomUserData.roomSeq] = { roomUserInfoMap[roomUserData.roomSeq] = {
userInfoList: [], userInfoList: [],
@ -238,17 +233,10 @@ export class Effects {
roomUserData.roomSeq roomUserData.roomSeq
].userInfoShortList.push(...roomUserData.userInfos); ].userInfoShortList.push(...roomUserData.userInfos);
} }
}
break; break;
case SSVC_TYPE_SYNC_ROOM_USER2: case SSVC_TYPE_SYNC_ROOM_USER2:
{ {
const roomUserDetailData = res as RoomUserDetailData; const roomUserDetailData = res as RoomUserDetailData;
if (
roomList.length > 0 &&
roomList.filter(
r => r.roomSeq === roomUserDetailData.roomSeq
).length > 0
) {
if (!roomUserInfoMap[roomUserDetailData.roomSeq]) { if (!roomUserInfoMap[roomUserDetailData.roomSeq]) {
roomUserInfoMap[roomUserDetailData.roomSeq] = { roomUserInfoMap[roomUserDetailData.roomSeq] = {
userInfoList: [], userInfoList: [],
@ -259,14 +247,31 @@ export class Effects {
roomUserDetailData.roomSeq roomUserDetailData.roomSeq
].userInfoList.push(...roomUserDetailData.userInfos); ].userInfoList.push(...roomUserDetailData.userInfos);
} }
}
break; break;
case SSVC_TYPE_SYNC_ROOM_RES: 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( this.store.dispatch(
roomSuccess({ roomSuccess({
roomList, roomList,
roomUserInfoMap, roomUserInfoMap: tmpRoomUserInfoMap,
syncDate: (res as RoomResponse).syncDate syncDate: (res as RoomResponse).syncDate
}) })
); );