Skip to content

Commit

Permalink
refactor: 调整 /api/stats/cluster/:id
Browse files Browse the repository at this point in the history
  • Loading branch information
SALTWOOD committed Nov 2, 2024
1 parent 2c113bc commit 6c49cda
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/routes/ApiStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ export class ApiStats {
const stats = inst.stats.find(s => s.id === clusterId);
if (stats) {
const data = stats.getLast30DaysStats();
const dates = data.map(d => d.date);
const dailyHits: number[] = data.map(d => d.hits);
const dailyBytes: number[] = data.map(d => d.bytes);
res.status(200).json([dailyHits, dailyBytes]);
res.status(200).json({dates, hits: dailyHits, bytes: dailyBytes});
} else {
res.status(404).send({ message: "Stats not found. This should never happen, please contact administrator." });
}
Expand Down

0 comments on commit 6c49cda

Please sign in to comment.