improvements+fixes

This commit is contained in:
2021-10-04 10:35:57 +02:00
parent a94647d549
commit 91958dc3ff
15 changed files with 72 additions and 72 deletions
+7 -10
View File
@@ -15,7 +15,7 @@ import { DateAdapter } from '@angular/material/core';
export class UiMain {
opened = true;
darkTheme = "false";
darkTheme: boolean = false;
title = 'bstlboard';
currentLocale: String;
datetimeformat: String;
@@ -51,7 +51,7 @@ export class UiMain {
}
if (localStorage.getItem("bstlboard.darkTheme") == "true") {
this.darkTheme = "true";
this.darkTheme = true;
window.document.body.classList.add("dark-theme");
}
}
@@ -72,18 +72,14 @@ export class UiMain {
}
}
darkThemeChange($event) {
if ($event.checked) {
this.darkTheme = "true";
} else {
this.darkTheme = "false";
}
toggleDarkTheme() {
this.darkTheme = !this.darkTheme;
localStorage.setItem("bstlboard.darkTheme", this.darkTheme);
localStorage.setItem("bstlboard.darkTheme", this.darkTheme ? "true" : "false");
if (this.auth && this.auth.authenticated) {
this.userService.get().subscribe((user: any) => {
user.darkTheme = $event.checked;
user.darkTheme = this.darkTheme;
this.userService.update(user).subscribe(() => {
window.location.reload();
})
@@ -95,6 +91,7 @@ export class UiMain {
}
logout() {
localStorage.removeItem("bstlboard.autologin");
this.authService.logout().subscribe(data => {
this.router.navigate([ "" ]).then(() => {
window.location.reload();