}
if (tm.name !== this.confStore.theme) {
this.confStore.theme = tm.name;
- this.save();
+ this.save(this.confStore);
}
});
this.confSubject.next(Object.assign({}, this.confStore));
} else {
// Set default config
- this.confStore = this.confDefault;
- this.save();
+ this.save(null);
}
}
// Save config into cookie
- save(cfg?: IConfig) {
- if (typeof cfg !== 'undefined') {
- this.confStore = this.confDefault;
- }
+ save(cfg: IConfig | null) {
+ this.confStore = (cfg !== null) ? cfg : this.confDefault;
// Notify subscribers
this.confSubject.next(Object.assign({}, this.confStore));