From 64ad7bbc7ffaf5cbfb6cb78c5731e77bdaa61cab Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Fri, 30 Sep 2022 14:43:10 +0100 Subject: [PATCH] remove on room expired --- src/app/services/chat.service.ts | 3 ++ src/app/services/chat/room.service.ts | 31 ++++++++++--------- .../services/chat/ws-chat-methods.service.ts | 3 +- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts index 51a5d0be3..5c1ee6032 100644 --- a/src/app/services/chat.service.ts +++ b/src/app/services/chat.service.ts @@ -387,6 +387,9 @@ export class ChatService { } catch (error) { this.resetTimer(); + setTimeout(async () => { + await this.refreshtoken(); + }, 3000) } diff --git a/src/app/services/chat/room.service.ts b/src/app/services/chat/room.service.ts index fbbf7c7b9..4bf10065a 100644 --- a/src/app/services/chat/room.service.ts +++ b/src/app/services/chat/room.service.ts @@ -76,6 +76,7 @@ export class RoomService { } sortRoomList = () => {} + chatServiceDeleteRoom = (roomId) => {} constructor( public WsChatService: WsChatService, @@ -231,22 +232,22 @@ export class RoomService { this.countDownTime = "Expired"; let body = { "roomId": this.id } - this.chatService.getRoomInfo(this.id).subscribe( room =>{ + // this.chatService.getRoomInfo(this.id).subscribe( room =>{}); - - if(this.t === 'p') { - this.chatService.deleteGroup(body).subscribe(res=>{ - this.wsChatMethodsService.deleteRoom(this.id); - this.wsChatMethodsService.getAllRooms(); - }); - } - else { - this.chatService.deleteChannel(body).subscribe(res=>{ - this.wsChatMethodsService.deleteRoom(this.id); - this.wsChatMethodsService.getAllRooms(); - }); - } - }); + if(this.t === 'p') { + this.chatService.deleteGroup(body).subscribe(res=>{ + this.wsChatMethodsService.deleteRoom(this.id); + this.wsChatMethodsService.getAllRooms(); + this.chatServiceDeleteRoom(this.id); + }); + } + else { + this.chatService.deleteChannel(body).subscribe(res=>{ + this.wsChatMethodsService.deleteRoom(this.id); + this.wsChatMethodsService.getAllRooms(); + this.chatServiceDeleteRoom(this.id); + }); + } } diff --git a/src/app/services/chat/ws-chat-methods.service.ts b/src/app/services/chat/ws-chat-methods.service.ts index 774db8aba..711120558 100644 --- a/src/app/services/chat/ws-chat-methods.service.ts +++ b/src/app/services/chat/ws-chat-methods.service.ts @@ -395,6 +395,7 @@ export class WsChatMethodsService { room.getAllUsers = this.getUsers room.receiveMessageDelete(); room.sortRoomList = this.sortRoomList + room.chatServiceDeleteRoom = this.deleteRoom // create individual room @@ -428,7 +429,7 @@ export class WsChatMethodsService { } - deleteRoom(roomId) { + deleteRoom =(roomId) => { this.delete.push(roomId) delete this.group[roomId];