From 1278e257c05d25464da6aa16462889aac9c56b0a Mon Sep 17 00:00:00 2001 From: dseydel Date: Fri, 1 Dec 2023 14:29:57 +0100 Subject: [PATCH] Change return type of getRoom method from string to object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified return type of getRoom method in room_manager.ts from string to object. Instead of converting the returned information into a JSON string it now returns the information as is in an object. This simplifies the data processing on the client’s end by removing the necessity to parse the string back to an object. This change also ensures type consistency which enhances code maintainability and reduces potential type-related issues. --- src/lib/room_manager.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/room_manager.ts b/src/lib/room_manager.ts index 2592a23..f230e3e 100644 --- a/src/lib/room_manager.ts +++ b/src/lib/room_manager.ts @@ -28,15 +28,15 @@ export default class RoomManager { } } - getRoom(room: string) : string { + getRoom(room: string) : object { if( this.rooms.has(room) ) { let roomData = this.rooms.get(room); - return JSON.stringify({ + return { 'host': roomData?.getHost(), 'clients': roomData?.getClientList() - }); + }; } - return "" + return {} } }