|
|
|
@ -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 (
|
|
|
|
|