From 39c619a8378c4c1e1d55e95de620cd6e490592e6 Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Thu, 13 Mar 2025 08:38:24 +0100 Subject: [PATCH] Fix RVO redirect URL for locale (without loosing queryparms) --- projects/common/src/fm/effects/app-common.effects.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/common/src/fm/effects/app-common.effects.ts b/projects/common/src/fm/effects/app-common.effects.ts index b849f87..8447a37 100644 --- a/projects/common/src/fm/effects/app-common.effects.ts +++ b/projects/common/src/fm/effects/app-common.effects.ts @@ -49,7 +49,7 @@ export class AppCommonEffects { switchMap((action) => { return zip(this.userService$.getCurrentUser(),from(this.oauthService$.loadUserProfile())).pipe( switchMap(([user,userInfo]) => { - if (location.hostname === 'localhost' || user.language === undefined || user.language === this.locale) + if (this.location.path === 'localhost' || user.language === undefined || user.language === this.locale) { return of(new appCommonActions.InitUserSuccess(user,userInfo as UserInfo)) } @@ -63,8 +63,8 @@ export class AppCommonEffects { ofType(appCommonActions.SWITCHLANGUAGE), switchMap((action) => { const a = action as appCommonActions.SwitchLanguage; - if (location.pathname.includes(`/${this.locale}/`)) { - const newPath = location.pathname.replace(`/${this.locale}/`, `/${a.locale}/`); + if (location.href.includes(`/${this.locale}/`)) { + const newPath = location.href.replace(`/${this.locale}/`, `/${a.locale}/`); location.replace(newPath); } return of(undefined);