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