remove on room expired

This commit is contained in:
Peter Maquiran
2022-09-30 14:43:10 +01:00
parent cc9be61de4
commit 64ad7bbc7f
3 changed files with 21 additions and 16 deletions
+3
View File
@@ -387,6 +387,9 @@ export class ChatService {
} catch (error) { } catch (error) {
this.resetTimer(); this.resetTimer();
setTimeout(async () => {
await this.refreshtoken();
}, 3000)
} }
+16 -15
View File
@@ -76,6 +76,7 @@ export class RoomService {
} }
sortRoomList = () => {} sortRoomList = () => {}
chatServiceDeleteRoom = (roomId) => {}
constructor( constructor(
public WsChatService: WsChatService, public WsChatService: WsChatService,
@@ -231,22 +232,22 @@ export class RoomService {
this.countDownTime = "Expired"; this.countDownTime = "Expired";
let body = { "roomId": this.id } let body = { "roomId": this.id }
this.chatService.getRoomInfo(this.id).subscribe( room =>{ // this.chatService.getRoomInfo(this.id).subscribe( room =>{});
if(this.t === 'p') {
if(this.t === 'p') { this.chatService.deleteGroup(body).subscribe(res=>{
this.chatService.deleteGroup(body).subscribe(res=>{ this.wsChatMethodsService.deleteRoom(this.id);
this.wsChatMethodsService.deleteRoom(this.id); this.wsChatMethodsService.getAllRooms();
this.wsChatMethodsService.getAllRooms(); this.chatServiceDeleteRoom(this.id);
}); });
} }
else { else {
this.chatService.deleteChannel(body).subscribe(res=>{ this.chatService.deleteChannel(body).subscribe(res=>{
this.wsChatMethodsService.deleteRoom(this.id); this.wsChatMethodsService.deleteRoom(this.id);
this.wsChatMethodsService.getAllRooms(); this.wsChatMethodsService.getAllRooms();
}); this.chatServiceDeleteRoom(this.id);
} });
}); }
} }
@@ -395,6 +395,7 @@ export class WsChatMethodsService {
room.getAllUsers = this.getUsers room.getAllUsers = this.getUsers
room.receiveMessageDelete(); room.receiveMessageDelete();
room.sortRoomList = this.sortRoomList room.sortRoomList = this.sortRoomList
room.chatServiceDeleteRoom = this.deleteRoom
// create individual room // create individual room
@@ -428,7 +429,7 @@ export class WsChatMethodsService {
} }
deleteRoom(roomId) { deleteRoom =(roomId) => {
this.delete.push(roomId) this.delete.push(roomId)
delete this.group[roomId]; delete this.group[roomId];