Skip to content
Snippets Groups Projects
Commit 94ba5aff authored by Chris Hines's avatar Chris Hines
Browse files

forgot to add setttings service

parent 4e6d7f47
No related branches found
No related tags found
2 merge requests!21New css dev,!18Dev
Pipeline #7809 passed
import { TestBed } from '@angular/core/testing';
import { SettingsService } from './settings.service';
describe('SettingsService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: SettingsService = TestBed.get(SettingsService);
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class SettingsService {
public theme$: BehaviorSubject<string>;
public menuToggle$: BehaviorSubject<boolean>;
public useMenu$: BehaviorSubject<boolean>;
constructor() {
this.menuToggle$ = new BehaviorSubject<boolean>(true);
this.theme$ = new BehaviorSubject<string>('strudel-theme-light');
this.useMenu$ = new BehaviorSubject<boolean>(true);
this.getTheme();
}
getTheme() {
var theme: string;
theme = localStorage.getItem('strudel-theme');
if (theme == null) {
this.theme$.next('strudel-theme-light');
return
} else {
this.theme$.next(theme);
}
}
setTheme(v: string) {
this.theme$.next(v);
localStorage.setItem('strudel-theme',v);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment