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

@ -11,6 +11,7 @@ import { NbThemeService } from '@nebular/theme';
import { AnalyticsService } from './@core/utils/analytics.service';
import { AbService } from './@core/utils/ab.service';
import { SeoService } from './@core/utils/seo.service';
import { CurrentThemeService } from './@core/utils/theme.service';
@Component({
selector: 'ngx-app',
@ -24,7 +25,8 @@ export class AppComponent implements OnInit {
private seoService: SeoService,
private activatedRoute: ActivatedRoute,
private abService: AbService,
private themeService: NbThemeService) {
private themeService: NbThemeService,
private currentThemeService: CurrentThemeService) {
this.themeService.onThemeChange()
.subscribe((theme: any) => {
@ -35,6 +37,8 @@ export class AppComponent implements OnInit {
.subscribe((params: any) => {
if (params.theme && this.themes.includes(params.theme)) {
this.themeService.changeTheme(params.theme);
} else {
this.themeService.changeTheme(this.currentThemeService.getCurrentTheme());
}
});
}