migration
This commit is contained in:
+20
-18
@@ -47,28 +47,30 @@ export class AuthenticatedGuard implements CanActivate {
|
||||
return that.router.navigateByUrl(that.router.parseUrl('/login?target=' + encodeURIComponent(state.url)), { skipLocationChange: true, replaceUrl: true });
|
||||
}
|
||||
|
||||
this.profileService.get([ "locale", "darkTheme" ]).subscribe((profileFields: any) => {
|
||||
let updateLocale = false;
|
||||
let darktheme = 'false';
|
||||
let updateTheme = false;
|
||||
for (let profileField of profileFields) {
|
||||
if (profileField.name == "darkTheme") {
|
||||
darktheme = profileField.value;
|
||||
} else if (profileField.name == "locale" && this.i18nService.locales.indexOf(profileField.value) != -1 && localStorage.getItem("bstly.locale") != profileField.value) {
|
||||
if (this.i18nService.locale != profileField.value) {
|
||||
localStorage.setItem("bstly.locale", profileField.value);
|
||||
updateLocale = true;
|
||||
this.profileService.get([ "locale", "darkTheme" ]).subscribe({
|
||||
next: (profileFields: any) => {
|
||||
let updateLocale = false;
|
||||
let darktheme = 'false';
|
||||
let updateTheme = false;
|
||||
for (let profileField of profileFields) {
|
||||
if (profileField.name == "darkTheme") {
|
||||
darktheme = profileField.value;
|
||||
} else if (profileField.name == "locale" && this.i18nService.locales.indexOf(profileField.value) != -1 && localStorage.getItem("bstly.locale") != profileField.value) {
|
||||
if (this.i18nService.locale != profileField.value) {
|
||||
localStorage.setItem("bstly.locale", profileField.value);
|
||||
updateLocale = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (darktheme != localStorage.getItem("bstly.darkTheme")) {
|
||||
localStorage.setItem("bstly.darkTheme", darktheme);
|
||||
updateTheme = true;
|
||||
}
|
||||
if (darktheme != localStorage.getItem("bstly.darkTheme")) {
|
||||
localStorage.setItem("bstly.darkTheme", darktheme);
|
||||
updateTheme = true;
|
||||
}
|
||||
|
||||
if (updateLocale || updateTheme) {
|
||||
window.location.reload();
|
||||
if (updateLocale || updateTheme) {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user