improvements+fixes
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user