save current show in global store

This commit is contained in:
2020-04-22 11:56:29 +02:00
committed by smuddy
parent 5c7e588c2a
commit 90ab0a76ae
9 changed files with 73 additions and 15 deletions

View File

@@ -0,0 +1,16 @@
import {TestBed} from '@angular/core/testing';
import {GlobalSettingsService} from './global-settings.service';
describe('GlobalSettingsService', () => {
let service: GlobalSettingsService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(GlobalSettingsService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@@ -0,0 +1,21 @@
import {Injectable} from '@angular/core';
import {DbService} from './db.service';
import {GlobalSettings} from './global-settings';
import {Observable} from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class GlobalSettingsService {
constructor(private db: DbService) {
}
public get get$(): Observable<GlobalSettings> {
return this.db.doc$<GlobalSettings>('global/static');
}
public async set(data: Partial<GlobalSettings>) {
await this.db.doc<GlobalSettings>('global/static').update(data);
}
}

View File

@@ -0,0 +1,3 @@
export interface GlobalSettings {
currentShow: string
}