상대방이 퇴장 했을때 sync 쪽 user list 갱신하면서 room 에 joincount 갱신하도록 수정.

This commit is contained in:
leejinho 2020-02-06 14:34:42 +09:00
parent b7483d2f12
commit 9fea3a1f22

View File

@ -103,6 +103,8 @@ export const reducer = createReducer(
}), }),
on(clearRoomUsers, (state, action) => { on(clearRoomUsers, (state, action) => {
const roomInfo = state.room.entities[action.roomSeq];
const roomUserList: RoomUserDetailData = { const roomUserList: RoomUserDetailData = {
...state.roomUser.entities[action.roomSeq] ...state.roomUser.entities[action.roomSeq]
}; };
@ -149,6 +151,15 @@ export const reducer = createReducer(
return { return {
...state, ...state,
room: adapterRoom.upsertOne(
{
...roomInfo,
joinUserCount: roomInfo.joinUserCount - action.userSeqs.length
},
{
...state.room
}
),
roomUser: !!trgtRoomUserList roomUser: !!trgtRoomUserList
? adapterRoomUser.upsertOne(trgtRoomUserList, { ? adapterRoomUser.upsertOne(trgtRoomUserList, {
...state.roomUser ...state.roomUser