update dependencies, migrate subscribe, add submit type to buttons
This commit is contained in:
+22
-20
@@ -48,28 +48,30 @@ export class AuthenticatedGuard implements CanActivate {
|
||||
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
||||
const that = this;
|
||||
return this.authService.getAuth().then((data: any) => {
|
||||
this.userService.get().subscribe((user: any) => {
|
||||
let updateLocale = false;
|
||||
let updateTheme = false;
|
||||
let darktheme = 'false';
|
||||
this.userService.get().subscribe({
|
||||
next: (user: any) => {
|
||||
let updateLocale = false;
|
||||
let updateTheme = false;
|
||||
let darktheme = 'false';
|
||||
|
||||
if (user.darkTheme) {
|
||||
darktheme = 'true';
|
||||
}
|
||||
|
||||
if (darktheme != localStorage.getItem("bstlboard.darkTheme")) {
|
||||
localStorage.setItem("bstlboard.darkTheme", darktheme);
|
||||
updateTheme = true;
|
||||
}
|
||||
|
||||
if (this.i18nService.locales.indexOf(user.locale) != -1 && localStorage.getItem("bstlboard.locale") != user.locale) {
|
||||
if (this.i18nService.locale != user.locale) {
|
||||
localStorage.setItem("bstlboard.locale", user.locale);
|
||||
updateLocale = true;
|
||||
if (user.darkTheme) {
|
||||
darktheme = 'true';
|
||||
}
|
||||
|
||||
if (darktheme != localStorage.getItem("bstlboard.darkTheme")) {
|
||||
localStorage.setItem("bstlboard.darkTheme", darktheme);
|
||||
updateTheme = true;
|
||||
}
|
||||
|
||||
if (this.i18nService.locales.indexOf(user.locale) != -1 && localStorage.getItem("bstlboard.locale") != user.locale) {
|
||||
if (this.i18nService.locale != user.locale) {
|
||||
localStorage.setItem("bstlboard.locale", user.locale);
|
||||
updateLocale = true;
|
||||
}
|
||||
}
|
||||
if (updateLocale || updateTheme) {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
if (updateLocale || updateTheme) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user