update dependencies, migrate subscribe, add submit type to buttons

This commit is contained in:
2024-02-26 15:11:48 +01:00
parent 43da1441d9
commit 31dc5e5c25
31 changed files with 4388 additions and 5047 deletions
+22 -20
View File
@@ -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();
}
});