Revision 56966
Added by Konstantina Galouni over 4 years ago
searchDatacite.service.ts | ||
---|---|---|
1 |
import {throwError as observableThrowError} from 'rxjs'; |
|
1 |
import {Observable, throwError as observableThrowError} from 'rxjs';
|
|
2 | 2 |
import {Injectable} from '@angular/core'; |
3 | 3 |
import {Response} from '@angular/http'; |
4 | 4 |
import {HttpClient} from '@angular/common/http'; |
5 | 5 |
import {EnvProperties} from '../../../utils/properties/env-properties'; |
6 | 6 |
import {ClaimEntity, ClaimResult} from '../claimHelper.class'; |
7 | 7 |
import {map} from "rxjs/operators"; |
8 |
|
|
8 |
import 'rxjs/add/operator/catch'; |
|
9 |
import 'rxjs/add/observable/of'; |
|
9 | 10 |
@Injectable() |
10 | 11 |
export class SearchDataciteService { |
11 | 12 |
constructor(private http: HttpClient ) {} |
... | ... | |
25 | 26 |
let key = url; |
26 | 27 |
|
27 | 28 |
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) |
28 |
.pipe(map(request => [1, (parse ? SearchDataciteService.parse(request["data"]) : request)]));
|
|
29 |
.pipe(map(request => (parse ? SearchDataciteService.parse([request["data"]])[0] : request))).catch(e => Observable.of(null));
|
|
29 | 30 |
} |
30 | 31 |
|
31 | 32 |
|
Also available in: Unified diff
[mergeResultLandingPages | Library]: Merging Trunk into branch 56883:56965