Files
brewman/overlord/src/app/core/batch.service.ts
tanshu 57ef355170 Fix: Login deleting old clients was conflicting with login history
Chore: Moved to angular linting using the recommended plugins / settings
2020-12-08 12:09:19 +05:30

23 lines
813 B
TypeScript

import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/internal/Observable';
import { catchError } from 'rxjs/operators';
import { Batch } from './batch';
import { ErrorLoggerService } from './error-logger.service';
const url = '/api/batch';
const serviceName = 'BatchService';
@Injectable({ providedIn: 'root' })
export class BatchService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
autocomplete(date: string, term: string): Observable<Batch[]> {
const options = { params: new HttpParams().set('q', term).set('d', date) };
return this.http
.get<Batch[]>(url, options)
.pipe(catchError(this.log.handleError(serviceName, 'autocomplete'))) as Observable<Batch[]>;
}
}