mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
25 lines
549 B
TypeScript
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);
|
|
}));
|
|
}
|
|
|
|
}
|