Fixed realtime chart display.

This commit is contained in:
Mike Cao committed 2023-02-17 21:42:42 -08:00
1 parent 93b77672f3
commit 802c262cd9
14 files changed
+112 -75

No files matched your search

+7 -2
View File
@@ -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);
}