fix(docs): guard before redirecting

This commit is contained in:
Alex 2020-04-01 16:23:58 +03:00 committed by Sergey Andrievskiy
parent 413cbdbd01
commit ec3ef4e879
5 changed files with 21 additions and 10 deletions

View file

@ -62,15 +62,14 @@ export class HeaderComponent implements OnInit, OnDestroy {
private analytics: AnalyticsService,
private currentThemeService: CurrentThemeService,
) {
}
ngOnInit() {
this.materialTheme$ = new Observable(subscriber => {
const themeName: string = this.currentThemeService.getCurrentTheme();
subscriber.next(themeName.startsWith('material'));
});
}
ngOnInit() {
this.currentTheme = this.themeService.currentTheme;
this.userService.getUsers()
@ -104,6 +103,10 @@ export class HeaderComponent implements OnInit, OnDestroy {
changeTheme(themeName: string) {
this.currentThemeService.setCurrentTheme(themeName);
this.themeService.changeTheme(themeName);
this.materialTheme$ = new Observable(subscriber => {
subscriber.next(this.currentThemeService.getCurrentTheme().startsWith('material'));
});
}
toggleSidebar(): boolean {