fix(theme): save theme in local storage after theme changing

This commit is contained in:
Alex 2020-03-25 21:16:01 +03:00 committed by Sergey Andrievskiy
parent 05cb3b3ffd
commit 5eef948132
3 changed files with 24 additions and 16 deletions

View file

@ -6,6 +6,7 @@ import { AnalyticsService, LayoutService } from '../../../@core/utils';
import { map, takeUntil } from 'rxjs/operators';
import { Subject, Observable } from 'rxjs';
import { RippleService } from '../../../@core/utils/ripple.service';
import {CurrentThemeService} from '../../../@core/utils/theme.service';
@Component({
selector: 'ngx-header',
@ -59,6 +60,7 @@ export class HeaderComponent implements OnInit, OnDestroy {
private breakpointService: NbMediaBreakpointsService,
private rippleService: RippleService,
private analytics: AnalyticsService,
private currentThemeService: CurrentThemeService,
) {
this.materialTheme$ = this.themeService.onThemeChange()
.pipe(map(theme => {
@ -99,6 +101,7 @@ export class HeaderComponent implements OnInit, OnDestroy {
}
changeTheme(themeName: string) {
this.currentThemeService.setCurrentTheme(themeName);
this.themeService.changeTheme(themeName);
}