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: case SSVC_TYPE_SYNC_ROOM_USER:
{ {
const roomUserData = res as RoomUserData; const roomUserData = res as RoomUserData;
if ( if (!roomUserInfoMap[roomUserData.roomSeq]) {
roomList.length > 0 && roomUserInfoMap[roomUserData.roomSeq] = {
roomList.filter(r => r.roomSeq === roomUserData.roomSeq) userInfoList: [],
.length > 0 userInfoShortList: []
) { };
if (!roomUserInfoMap[roomUserData.roomSeq]) {
roomUserInfoMap[roomUserData.roomSeq] = {
userInfoList: [],
userInfoShortList: []
};
}
roomUserInfoMap[
roomUserData.roomSeq
].userInfoShortList.push(...roomUserData.userInfos);
} }
roomUserInfoMap[
roomUserData.roomSeq
].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 ( if (!roomUserInfoMap[roomUserDetailData.roomSeq]) {
roomList.length > 0 && roomUserInfoMap[roomUserDetailData.roomSeq] = {
roomList.filter( userInfoList: [],
r => r.roomSeq === roomUserDetailData.roomSeq userInfoShortList: []
).length > 0 };
) {
if (!roomUserInfoMap[roomUserDetailData.roomSeq]) {
roomUserInfoMap[roomUserDetailData.roomSeq] = {
userInfoList: [],
userInfoShortList: []
};
}
roomUserInfoMap[
roomUserDetailData.roomSeq
].userInfoList.push(...roomUserDetailData.userInfos);
} }
roomUserInfoMap[
roomUserDetailData.roomSeq
].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
}) })
); );