Move block audit cache to apiService
This commit is contained in:
@@ -18,6 +18,7 @@ export class ApiService {
|
||||
private apiBasePath: string; // network path is /testnet, etc. or '' for mainnet
|
||||
|
||||
private requestCache = new Map<string, { subject: BehaviorSubject<any>, expiry: number }>;
|
||||
public blockAuditLoaded: { [hash: string]: boolean } = {};
|
||||
|
||||
constructor(
|
||||
private httpClient: HttpClient,
|
||||
@@ -370,6 +371,7 @@ export class ApiService {
|
||||
}
|
||||
|
||||
getBlockAudit$(hash: string) : Observable<BlockAudit> {
|
||||
this.setBlockAuditLoaded(hash);
|
||||
return this.httpClient.get<BlockAudit>(
|
||||
this.apiBaseUrl + this.apiBasePath + `/api/v1/block/${hash}/audit-summary`
|
||||
);
|
||||
@@ -533,4 +535,13 @@ export class ApiService {
|
||||
this.apiBaseUrl + this.apiBasePath + '/api/v1/accelerations/total' + (queryString?.length ? '?' + queryString : '')
|
||||
);
|
||||
}
|
||||
|
||||
// Cache methods
|
||||
async setBlockAuditLoaded(hash: string) {
|
||||
this.blockAuditLoaded[hash] = true;
|
||||
}
|
||||
|
||||
getBlockAuditLoaded(hash) {
|
||||
return this.blockAuditLoaded[hash];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user