diff --git a/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts b/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts index 38696c1..b35a3b2 100644 --- a/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts +++ b/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts @@ -72,13 +72,12 @@ export class HttpService { } /** - * TODO: Delete this method * Retrieves the room preferences. * * @returns {Promise} A promise that resolves to the room preferences. */ - getRoomPreferences(): Promise { - return this.getRequest(`${this.API_PATH_PREFIX}/preferences/room`); + getRoomPreferences(roomId: string): Promise { + return this.getRequest(`${this.INTERNAL_API_PATH_PREFIX}/rooms/${roomId}/preferences`); } /** diff --git a/frontend/projects/shared-meet-components/src/lib/services/room/room.service.ts b/frontend/projects/shared-meet-components/src/lib/services/room/room.service.ts index 7be51e9..4df15b0 100644 --- a/frontend/projects/shared-meet-components/src/lib/services/room/room.service.ts +++ b/frontend/projects/shared-meet-components/src/lib/services/room/room.service.ts @@ -41,6 +41,22 @@ export class RoomService { return this.httpService.getRoom(roomId); } + async getRoomPreferences(roomId: string): Promise { + this.log.d('Fetching room preferences for roomId:', roomId); + try { + const preferences = await this.httpService.getRoomPreferences(roomId); + + if (!preferences) { + this.log.w('Room preferences not found for roomId:', roomId); + throw new Error(`Preferences not found for roomId: ${roomId}`); + } + return preferences; + } catch (error) { + this.log.e('Error fetching room preferences', error); + throw new Error(`Failed to fetch room preferences for roomId: ${roomId}`); + } + } + async loadPreferences(roomId: string, forceUpdate: boolean = false): Promise { if (this.roomPreferences && !forceUpdate) { this.log.d('Returning cached room preferences'); @@ -49,8 +65,7 @@ export class RoomService { this.log.d('Fetching room preferences from server'); try { - const room = await this.getRoom(roomId); - this.roomPreferences = room.preferences! as MeetRoomPreferences; + this.roomPreferences = await this.getRoomPreferences(roomId); this.featureConfService.setRoomPreferences(this.roomPreferences); console.log('Room preferences loaded:', this.roomPreferences); return this.roomPreferences;