sh_discord_bot/kdb-web/src/app/app.component.ts

44 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-10-16 00:13:03 +02:00
import { Component, OnInit } from '@angular/core';
import { AuthService } from './services/auth/auth.service';
2022-10-16 01:55:20 +02:00
import { SocketService } from './services/socket/socket.service';
2022-10-16 00:13:03 +02:00
import { ThemeService } from './services/theme/theme.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
themeName!: string;
sidebarWidth!: string;
isLoggedIn: boolean = false;
2022-10-16 00:13:03 +02:00
constructor(
2022-10-16 16:01:37 +02:00
private authService: AuthService,
private themeService: ThemeService,
2022-10-16 01:55:20 +02:00
private socket: SocketService
2022-10-16 00:13:03 +02:00
) { }
ngOnInit(): void {
this.themeService.sidebarWidth$.subscribe(value => {
this.sidebarWidth = value;
});
this.themeService.themeName$.subscribe(value => {
this.themeName = value;
});
2022-10-16 16:01:37 +02:00
this.authService.isLoggedIn$.subscribe(value => {
this.isLoggedIn = value;
});
2022-10-16 00:13:03 +02:00
this.themeService.loadTheme();
2022-10-16 16:01:37 +02:00
this.socket.startSocket();
2022-10-16 00:13:03 +02:00
}
setSideWidth($event: any): void {
this.themeService.setSideWidth($event);
}
2022-10-16 00:13:03 +02:00
}