Production release February 2024 #30

Merged
konstantina.galouni merged 10 commits from develop into master 2024-02-07 21:37:51 +01:00
2 changed files with 18 additions and 5 deletions
Showing only changes of commit 137278522e - Show all commits

View File

@ -218,7 +218,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
}
}
if (typeof document !== 'undefined') {
this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
this.subscriptions.push(this.indexInfoService.lastIndexDate.subscribe(lastIndexUpdate => {
if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
}

View File

@ -1,21 +1,34 @@
import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {EnvProperties} from './properties/env-properties';
import {Observable, of} from "rxjs";
import {BehaviorSubject, Observable, of} from "rxjs";
import {catchError, map} from "rxjs/operators";
import {properties} from "../../../environments/environment";
@Injectable({
providedIn: "root"
})
export class IndexInfoService {
private lastIndexDateSubject: BehaviorSubject<any> = new BehaviorSubject<any>(null);
constructor(private http: HttpClient) {
}
getLastIndexDate(properties: EnvProperties): Observable<any> {
let url = properties.indexInfoAPI;
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)): url).pipe(map(res => res['claim_load_date'])).pipe(catchError(err => {return of(null)}));
get lastIndexDate(): Observable<any> {
return this.lastIndexDateSubject.getValue() ? this.lastIndexDateSubject.asObservable() : this.getLastIndexDate();
}
setLastIndexDate(value: any) {
this.lastIndexDateSubject.next(value);
}
getLastIndexDate(props: EnvProperties = properties): Observable<any> {
let url = props.indexInfoAPI;
return this.http.get((props.useLongCache)? (props.cacheUrl+encodeURIComponent(url)): url).pipe(map(res => {
this.setLastIndexDate(res['claim_load_date']);
return res['claim_load_date'];
})).pipe(catchError(err => {return of(null)}));
}
getStatsLastDate(properties: EnvProperties): Observable<any> {
let url = properties.indexInfoAPI;