Polish mining page UI

Make sure to wait for all mining pools queries before continuing
This commit is contained in:
nymkappa
2022-01-21 21:50:57 +09:00
parent 40e529ece7
commit f8f9108ae1
5 changed files with 99 additions and 50 deletions

View File

@@ -265,7 +265,7 @@ class Server {
.get(config.MEMPOOL.API_URL_PREFIX + 'statistics/1y', routes.$getStatisticsByTime.bind(routes, '1y'))
.get(config.MEMPOOL.API_URL_PREFIX + 'statistics/2y', routes.$getStatisticsByTime.bind(routes, '2y'))
.get(config.MEMPOOL.API_URL_PREFIX + 'statistics/3y', routes.$getStatisticsByTime.bind(routes, '3y'))
.get(config.MEMPOOL.API_URL_PREFIX + 'pools', routes.getPools)
.get(config.MEMPOOL.API_URL_PREFIX + 'pools', routes.$getPools)
;
}

View File

@@ -532,9 +532,12 @@ class Routes {
}
}
public async getPools(req: Request, res: Response) {
public async $getPools(req: Request, res: Response) {
try {
let stats = await miningStats.$getPoolsStats(req.query.interval as string);
// res.header('Pragma', 'public');
// res.header('Cache-control', 'public');
// res.setHeader('Expires', new Date(Date.now() + 1000 * 300).toUTCString());
res.json(stats);
} catch (e) {
res.status(500).send(e instanceof Error ? e.message : e);