brewman/overlord/src/app/batch-integrity-report/batch-integrity-report.service.ts

27 lines
807 B
TypeScript
Raw Normal View History

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/internal/Observable';
import { catchError } from 'rxjs/operators';
import { ErrorLoggerService } from '../core/error-logger.service';
import { BatchIntegrity } from './batch-integrity';
const serviceName = 'BatchIntegrityReportService';
@Injectable({
providedIn: 'root',
})
export class BatchIntegrityReportService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
batchIntegrity(): Observable<BatchIntegrity[]> {
const url = '/api/batch-integrity';
return this.http
.post<BatchIntegrity[]>(url, {})
.pipe(catchError(this.log.handleError(serviceName, 'batchIntegrity'))) as Observable<
BatchIntegrity[]
>;
}
}