integration layer; merge work on indicators from forks with existing ingestion pipeline
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable, map, shareReplay } from 'rxjs';
|
||||
import { TargetMeta } from './api.types';
|
||||
|
||||
/** GET /imports/targets, fetched once per app and shared. */
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class TargetsApi {
|
||||
private readonly http = inject(HttpClient);
|
||||
private readonly targets$ = this.http
|
||||
.get<{ targets: TargetMeta[] }>('/imports/targets')
|
||||
.pipe(
|
||||
map((response) => response.targets),
|
||||
shareReplay({ bufferSize: 1, refCount: false }),
|
||||
);
|
||||
|
||||
list(): Observable<TargetMeta[]> {
|
||||
return this.targets$;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user