Commit 94ba5aff authored by Chris Hines's avatar Chris Hines
Browse files

forgot to add setttings service

parent 4e6d7f47
Pipeline #7809 passed with stages
in 13 minutes and 41 seconds
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);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment