Moved stuff around, changed the way I'm storing milestones data

This commit is contained in:
2024-05-25 21:38:22 -04:00
parent 17f5b675b9
commit 818adc0d47
21 changed files with 437 additions and 166 deletions

View File

@@ -0,0 +1,25 @@
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
import { KeyValue } from '../models/key-value';
@Injectable({ providedIn: 'root' })
export class FilterService {
private _values: KeyValue[] = [];
private set filters(value: KeyValue[]) {
this._values = value;
this.filterSubject.next(this._values);
}
private get filters(): KeyValue[] {
return this._values;
}
private filterSubject = new Subject<KeyValue[]>();
readonly filters$ = this.filterSubject.asObservable();
constructor() {}
set(key: string, value: any): void {
const update = this.filters.filter((f: KeyValue) => f.key !== key);
if (!!value) update.push(new KeyValue({ key: key, value: value }));
this.filters = update;
}
}