[748a59]: / nih-ct-protocol-ui / src / app / criteria.service.ts

Download this file

23 lines (18 with data), 600 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
@Injectable()
export class CriteriaService {
apiUrl = '/get-suggestion/'; // URL to web api
private handleError: HandleError;
constructor(
private http: HttpClient,
httpErrorHandler: HttpErrorHandler) {
this.handleError = httpErrorHandler.createHandleError('CriteriaService');
}
//////// Save methods //////////
/** POST: add a new hero to the database */
addInput (criteria: Criteria): Observable<Criteria> {
return this.http.post<Criteria>(this.apiUrl, criteria, httpOptions)
.pipe(
catchError(this.handleError('addInput', criteria))
);
}
}