Get all pools in accelerations list

This commit is contained in:
natsoni 2024-07-25 17:45:08 +02:00
parent 78ac0137b3
commit 90331e2c1b
No known key found for this signature in database
GPG key ID: C65917583181743B
2 changed files with 17 additions and 4 deletions

View file

@ -83,9 +83,9 @@ export class AccelerationsListComponent implements OnInit, OnDestroy {
this.pageChange(this.page);
});
this.miningService.getMiningStats('1m').subscribe(stats => {
for (const pool of stats.pools) {
this.pools[pool.poolUniqueId] = pool;
this.miningService.getPools().subscribe(pools => {
for (const pool of pools) {
this.pools[pool.unique_id] = pool;
}
});
}

View file

@ -31,6 +31,7 @@ export class MiningService {
data: MiningStats;
}
} = {};
poolsData: SinglePoolStats[] = [];
constructor(
private stateService: StateService,
@ -58,6 +59,18 @@ export class MiningService {
}
}
/**
* Get names and slugs of all pools
*/
public getPools(): Observable<any[]> {
return this.poolsData.length ? of(this.poolsData) : this.apiService.listPools$(undefined).pipe(
map(response => {
this.poolsData = response.body;
return this.poolsData;
})
);
}
/**
* Set the hashrate power of ten we want to display
*/