frontend: allow using leave-redirect-url param also in embedded mode
This commit is contained in:
parent
e611c24231
commit
51a379af33
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user