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

44 lines
1.1 KiB
TypeScript

import { Component, OnInit } from '@angular/core';
import { AuthService } from './services/auth/auth.service';
import { SocketService } from './services/socket/socket.service';
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;
constructor(
private authService: AuthService,
private themeService: ThemeService,
private socket: SocketService
) { }
ngOnInit(): void {
this.themeService.sidebarWidth$.subscribe(value => {
this.sidebarWidth = value;
});
this.themeService.themeName$.subscribe(value => {
this.themeName = value;
});
this.authService.isLoggedIn$.subscribe(value => {
this.isLoggedIn = value;
});
this.themeService.loadTheme();
this.socket.startSocket();
}
setSideWidth($event: any): void {
this.themeService.setSideWidth($event);
}
}