diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f7b1def9..8fc2cd50f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Changed + +- Persisted the language on url change + ## 1.204.1 - 15.10.2022 ### Added diff --git a/apps/client/src/app/core/auth.guard.ts b/apps/client/src/app/core/auth.guard.ts index 1087fa4a3..349d44fb4 100644 --- a/apps/client/src/app/core/auth.guard.ts +++ b/apps/client/src/app/core/auth.guard.ts @@ -5,6 +5,7 @@ import { Router, RouterStateSnapshot } from '@angular/router'; +import { DataService } from '@ghostfolio/client/services/data.service'; import { SettingsStorageService } from '@ghostfolio/client/services/settings-storage.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; import { EMPTY } from 'rxjs'; @@ -30,6 +31,7 @@ export class AuthGuard implements CanActivate { ]; constructor( + private dataService: DataService, private router: Router, private settingsStorageService: SettingsStorageService, private userService: UserService @@ -74,7 +76,12 @@ export class AuthGuard implements CanActivate { const userLanguage = user?.settings?.language; if (userLanguage && document.documentElement.lang !== userLanguage) { - window.location.href = `../${userLanguage}`; + this.dataService + .putUserSetting({ language: userLanguage }) + .subscribe(() => { + this.userService.remove(); + }); + resolve(false); return; } else if (