diff --git a/frontend/projects/shared-meet-components/src/lib/pages/disconnected/disconnected.component.ts b/frontend/projects/shared-meet-components/src/lib/pages/disconnected/disconnected.component.ts index 16aeab7..cf8d3f2 100644 --- a/frontend/projects/shared-meet-components/src/lib/pages/disconnected/disconnected.component.ts +++ b/frontend/projects/shared-meet-components/src/lib/pages/disconnected/disconnected.component.ts @@ -108,15 +108,14 @@ export class DisconnectedComponent implements OnInit { /** * Handles the back button click event and navigates accordingly * If in embedded mode, it closes the WebComponentManagerService - * If in standalone mode, it navigates to the redirect URL or to the admin console + * If the redirect URL is set, it navigates to that URL + * If in standalone mode without a redirect URL, it navigates to the admin console */ async goBack() { if (this.appDataService.isEmbeddedMode()) { this.wcManagerService.close(); - return; } - // Standalone mode handling const redirectTo = this.navService.getLeaveRedirectURL(); if (redirectTo) { // Navigate to the specified redirect URL @@ -124,7 +123,9 @@ export class DisconnectedComponent implements OnInit { return; } - // Navigate to the admin console - await this.navService.navigateTo('/overview', undefined, true); + if (this.appDataService.isStandaloneMode()) { + // Navigate to the admin console + await this.navService.navigateTo('/overview', undefined, true); + } } } diff --git a/frontend/projects/shared-meet-components/src/lib/pages/error/error.component.ts b/frontend/projects/shared-meet-components/src/lib/pages/error/error.component.ts index 6c3ffce..f67c96d 100644 --- a/frontend/projects/shared-meet-components/src/lib/pages/error/error.component.ts +++ b/frontend/projects/shared-meet-components/src/lib/pages/error/error.component.ts @@ -119,15 +119,14 @@ export class ErrorComponent implements OnInit { /** * Handles the back button click event and navigates accordingly * If in embedded mode, it closes the WebComponentManagerService - * If in standalone mode, it navigates to the redirect URL or to the admin console + * If the redirect URL is set, it navigates to that URL + * If in standalone mode without a redirect URL, it navigates to the admin console */ async goBack() { if (this.appDataService.isEmbeddedMode()) { this.wcManagerService.close(); - return; } - // Standalone mode handling const redirectTo = this.navService.getLeaveRedirectURL(); if (redirectTo) { // Navigate to the specified redirect URL @@ -135,7 +134,9 @@ export class ErrorComponent implements OnInit { return; } - // Navigate to the admin console - await this.navService.navigateTo('/overview', undefined, true); + if (this.appDataService.isStandaloneMode()) { + // Navigate to the admin console + await this.navService.navigateTo('/overview', undefined, true); + } } } diff --git a/frontend/projects/shared-meet-components/src/lib/pages/video-room/video-room.component.ts b/frontend/projects/shared-meet-components/src/lib/pages/video-room/video-room.component.ts index c392760..00abc20 100644 --- a/frontend/projects/shared-meet-components/src/lib/pages/video-room/video-room.component.ts +++ b/frontend/projects/shared-meet-components/src/lib/pages/video-room/video-room.component.ts @@ -195,15 +195,14 @@ export class VideoRoomComponent implements OnInit { /** * Handles the back button click event and navigates accordingly * If in embedded mode, it closes the WebComponentManagerService - * If in standalone mode, it navigates to the redirect URL or to the rooms page + * If the redirect URL is set, it navigates to that URL + * If in standalone mode without a redirect URL, it navigates to the rooms page */ async goBack() { if (this.appDataService.isEmbeddedMode()) { this.wcManagerService.close(); - return; } - // Standalone mode handling const redirectTo = this.navigationService.getLeaveRedirectURL(); if (redirectTo) { // Navigate to the specified redirect URL @@ -211,8 +210,10 @@ export class VideoRoomComponent implements OnInit { return; } - // Navigate to rooms page - await this.navigationService.navigateTo('/rooms'); + if (this.appDataService.isStandaloneMode()) { + // Navigate to rooms page + await this.navigationService.navigateTo('/rooms'); + } } async submitAccessRoom() { diff --git a/frontend/projects/shared-meet-components/src/lib/services/navigation.service.ts b/frontend/projects/shared-meet-components/src/lib/services/navigation.service.ts index d745933..b9f568c 100644 --- a/frontend/projects/shared-meet-components/src/lib/services/navigation.service.ts +++ b/frontend/projects/shared-meet-components/src/lib/services/navigation.service.ts @@ -2,7 +2,7 @@ import { Location } from '@angular/common'; import { Injectable } from '@angular/core'; import { Params, Router, UrlTree } from '@angular/router'; import { ErrorReason } from '@lib/models'; -import { SessionStorageService } from '@lib/services'; +import { AppDataService, SessionStorageService } from '@lib/services'; @Injectable({ providedIn: 'root' @@ -13,7 +13,8 @@ export class NavigationService { constructor( private router: Router, private location: Location, - private sessionStorageService: SessionStorageService + private sessionStorageService: SessionStorageService, + private appDataService: AppDataService ) {} setLeaveRedirectUrl(leaveRedirectUrl: string): void { @@ -57,7 +58,13 @@ export class NavigationService { const isExternalURL = /^https?:\/\//.test(url); if (isExternalURL) { console.log('Redirecting to external URL:', url); - window.location.href = url; + + if (this.appDataService.isEmbeddedMode()) { + // Change the top window location if in embedded mode + window.top!.location.href = url; + } else { + window.location.href = url; + } } else { console.log('Redirecting to internal route:', url);