mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 06:07:17 +01:00
Fixed realtime chart display.
This commit is contained in:
parent
93b77672f3
commit
802c262cd9
14 changed files with 112 additions and 75 deletions
|
|
@ -9,9 +9,14 @@ export default async (req: NextApiRequestAuth, res: NextApiResponse<RealtimeInit
|
|||
await useAuth(req, res);
|
||||
|
||||
if (req.method === 'GET') {
|
||||
const { id } = req.query;
|
||||
const { id, startAt } = req.query;
|
||||
let startTime = subMinutes(new Date(), 30);
|
||||
|
||||
const data = await getRealtimeData(id, subMinutes(new Date(), 30));
|
||||
if (+startAt > startTime.getTime()) {
|
||||
startTime = new Date(+startAt);
|
||||
}
|
||||
|
||||
const data = await getRealtimeData(id, startTime);
|
||||
|
||||
return ok(res, data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue