new auth, hot entries

This commit is contained in:
2021-10-05 14:39:31 +02:00
parent 8cc7978954
commit 1da5fc638c
14 changed files with 149 additions and 128 deletions
+8 -6
View File
@@ -10,7 +10,8 @@ import { DateAdapter } from '@angular/material/core';
@Component({
selector: 'ui-main',
templateUrl: './main.ui.html'
templateUrl: './main.ui.html',
styleUrls : ['./main.ui.scss']
})
export class UiMain {
@@ -20,7 +21,7 @@ export class UiMain {
currentLocale: String;
datetimeformat: String;
locales;
auth;
authenticated : boolean = false;
constructor(
private i18n: I18nService,
@@ -38,7 +39,9 @@ export class UiMain {
this.currentLocale = this.i18n.getLocale();
this.locales = this.i18n.getLocales();
this.authService.auth.subscribe(data => {
this.auth = data;
this.authenticated = true;
}, (error) => {
this.authenticated = false;
})
this._adapter.setLocale(this.currentLocale);
@@ -59,8 +62,7 @@ export class UiMain {
setLocale(locale) {
localStorage.setItem("bstlboard.locale", locale);
if (this.auth && this.auth.authenticated) {
if (this.authenticated) {
this.userService.get().subscribe((user: any) => {
user.locale = locale;
this.userService.update(user).subscribe(() => {
@@ -77,7 +79,7 @@ export class UiMain {
localStorage.setItem("bstlboard.darkTheme", this.darkTheme ? "true" : "false");
if (this.auth && this.auth.authenticated) {
if (this.authenticated) {
this.userService.get().subscribe((user: any) => {
user.darkTheme = this.darkTheme;
this.userService.update(user).subscribe(() => {