Skip to content

Commit

Permalink
fix(chat): leaveRoom fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sdimitris committed Jan 11, 2022
1 parent ec4f86e commit cce0a54
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/chat/src/routes/Routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class ChatRoutes {
.findOne({ _id: roomId })
.catch((e: Error) => {
errorMessage = e.message;
});
}) as ChatRoom;
if (!isNil(errorMessage)) {
return callback({ code: status.INTERNAL, message: errorMessage });
}
Expand All @@ -132,11 +132,11 @@ export class ChatRoutes {

const index = (room as ChatRoom).participants.indexOf(user._id);
if (index > -1) {
(room as ChatRoom).participants.splice(index, 1);
room.participants = room.participants.splice(index, 1);
await ChatRoom.getInstance()
.findByIdAndUpdate(
(room as ChatRoom)._id,
{ room }
room,
)
.catch((e: Error) => {
errorMessage = e.message;
Expand Down

0 comments on commit cce0a54

Please sign in to comment.