Project

General

Profile

1 50169 argiro.kok
import {Injectable} from '@angular/core';
2 55982 argiro.kok
import {HttpClient} from '@angular/common/http';
3 55581 argiro.kok
import {EnvProperties} from './properties/env-properties';
4 58723 k.triantaf
import {Observable, of} from "rxjs";
5 59367 argiro.kok
import {catchError, map} from "rxjs/operators";
6 50169 argiro.kok
7
8 58723 k.triantaf
@Injectable({
9
  providedIn: "root"
10
})
11 55581 argiro.kok
export class IndexInfoService {
12 50169 argiro.kok
13 55982 argiro.kok
  constructor(private http: HttpClient) {
14 55581 argiro.kok
  }
15 50169 argiro.kok
16 58723 k.triantaf
  getLastIndexDate(properties: EnvProperties): Observable<any> {
17 59367 argiro.kok
    let url = properties.indexInfoAPI;
18 59395 argiro.kok
    return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)): url).pipe(map(res => res['claim_load_date'])).pipe(catchError(err => {return of(null)}));
19 55581 argiro.kok
  }
20 59979 argiro.kok
  getStatsLastDate(properties: EnvProperties): Observable<any> {
21
    let url = properties.indexInfoAPI;
22
    return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)): url).pipe(map(res => res['stats_update_date'])).pipe(catchError(err => {return of(null)}));
23
  }
24 55581 argiro.kok
}
25 50169 argiro.kok
26