From 2f4ef5607065134c4e632007ab213261387eae55 Mon Sep 17 00:00:00 2001 From: Bastian Jakobi Date: Wed, 24 Jul 2024 10:30:59 +0200 Subject: [PATCH] refactor: improve webcomponent router initializer --- .../src/lib/utils/webcomponent-router-initializer.utils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/angular-webcomponents/src/lib/utils/webcomponent-router-initializer.utils.ts b/libs/angular-webcomponents/src/lib/utils/webcomponent-router-initializer.utils.ts index 8cd7f907..c6c7d395 100644 --- a/libs/angular-webcomponents/src/lib/utils/webcomponent-router-initializer.utils.ts +++ b/libs/angular-webcomponents/src/lib/utils/webcomponent-router-initializer.utils.ts @@ -1,3 +1,4 @@ +import { Location } from '@angular/common' import { Router } from '@angular/router' import { AppStateService } from '@onecx/portal-integration-angular' import { firstValueFrom, map } from 'rxjs' @@ -12,7 +13,10 @@ export function initializeRouter(router: Router, appStateService: AppStateServic route.data = { ...route.data, mfeInfo: mfeInfo, - } + }, + route.redirectTo = route.redirectTo && typeof route.redirectTo === 'string' + ? Location.joinWithSlash(mfeInfo.baseHref, route.redirectTo) + : route.redirectTo }) routes.push({ path: '**',