Files
dspace-angular/src/app/core/services/api.service.ts
2019-06-18 08:58:35 +02:00

25 lines
549 B
TypeScript

import { throwError as observableThrowError } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable()
export class ApiService {
constructor(public _http: HttpClient) {
}
/**
* whatever domain/feature method name
*/
get(url: string, options?: any) {
return this._http.get(url, options).pipe(
catchError((err) => {
console.log('Error: ', err);
return observableThrowError(err);
}));
}
}