frontend: Refactor room navigation logic to use publisherRoomUrl and simplify query parameter handling

This commit is contained in:
Carlos Santos 2025-03-13 13:12:13 +01:00
parent fbb6e78653
commit e86a6e8ed6

View File

@ -149,14 +149,11 @@ export class HomeComponent implements OnInit, OnDestroy {
this.roomForm.get('roomNamePrefix')?.setValue(roomNamePrefix);
const publisherUrl = new URL(room.moderatorRoomUrl);
const queryParams = publisherUrl.searchParams;
const path = publisherUrl.pathname.slice(1);
// !FIXME here, the participantName is not set and the guard of VideoRoomComponent will need it.
// Possibly, when standalone mode, the room should be created in prejoin page instead of home page.
this.router.navigate(['/', path], { queryParams: { secret: queryParams.get('secret') } });
// TODO: Should create a way of select the access role (moderator/participant)
const publisherUrl = new URL(room.publisherRoomUrl);
const secret = publisherUrl.searchParams.get('secret');
const path = publisherUrl.pathname;
this.router.navigate([path], { queryParams: { secret } });
} catch (error) {
console.error('Error creating room ', error);
}