Fix RVO redirect URL for locale (without loosing queryparms)
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit

This commit is contained in:
Peter (extern) 2025-03-13 08:38:24 +01:00
parent 758613aa12
commit 39c619a837

View File

@ -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);