2019-07-23 14:23:12 +02:00
|
|
|
import {Injectable} from '@angular/core';
|
|
|
|
import {HttpClient} from '@angular/common/http';
|
|
|
|
import {EnvProperties} from './properties/env-properties';
|
2020-05-19 17:33:47 +02:00
|
|
|
import {Observable, of} from "rxjs";
|
2020-09-14 17:48:43 +02:00
|
|
|
import {catchError, map} from "rxjs/operators";
|
2019-07-23 14:23:12 +02:00
|
|
|
|
|
|
|
|
2020-05-19 17:33:47 +02:00
|
|
|
@Injectable({
|
|
|
|
providedIn: "root"
|
|
|
|
})
|
2019-07-23 14:23:12 +02:00
|
|
|
export class IndexInfoService {
|
|
|
|
|
|
|
|
constructor(private http: HttpClient) {
|
|
|
|
}
|
|
|
|
|
2020-05-19 17:33:47 +02:00
|
|
|
getLastIndexDate(properties: EnvProperties): Observable<any> {
|
2020-09-14 17:48:43 +02:00
|
|
|
let url = properties.indexInfoAPI;
|
2020-09-16 11:43:59 +02:00
|
|
|
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)): url).pipe(map(res => res['claim_load_date'])).pipe(catchError(err => {return of(null)}));
|
2019-07-23 14:23:12 +02:00
|
|
|
}
|
2020-11-27 11:42:30 +01:00
|
|
|
getStatsLastDate(properties: EnvProperties): Observable<any> {
|
|
|
|
let url = properties.indexInfoAPI;
|
|
|
|
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)): url).pipe(map(res => res['stats_update_date'])).pipe(catchError(err => {return of(null)}));
|
|
|
|
}
|
2021-05-19 15:07:43 +02:00
|
|
|
getLastOrcidUpdateDate(properties: EnvProperties): Observable<any> {
|
|
|
|
let url = properties.indexInfoAPI;
|
|
|
|
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)): url).pipe(map(res => res['orcid_update_date'])).pipe(catchError(err => {return of(null)}));
|
|
|
|
}
|
2019-07-23 14:23:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|