mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 13:47:15 +01:00
Fixed realtime chart rendering.
This commit is contained in:
parent
7a5f28870f
commit
92a513e4d0
5 changed files with 49 additions and 26 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { subMinutes } from 'date-fns';
|
||||
import { startOfMinute, subMinutes } from 'date-fns';
|
||||
import { canViewWebsite } from 'lib/auth';
|
||||
import { useAuth, useValidate } from 'lib/middleware';
|
||||
import { NextApiRequestQueryBody, RealtimeInit } from 'lib/types';
|
||||
|
|
@ -6,6 +6,8 @@ import { NextApiResponse } from 'next';
|
|||
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { getRealtimeData } from 'queries';
|
||||
import * as yup from 'yup';
|
||||
import { REALTIME_RANGE } from 'lib/constants';
|
||||
|
||||
export interface RealtimeRequestQuery {
|
||||
id: string;
|
||||
startAt: number;
|
||||
|
|
@ -32,7 +34,7 @@ export default async (
|
|||
return unauthorized(res);
|
||||
}
|
||||
|
||||
let startTime = subMinutes(new Date(), 30);
|
||||
let startTime = subMinutes(startOfMinute(new Date()), REALTIME_RANGE);
|
||||
|
||||
if (+startAt > startTime.getTime()) {
|
||||
startTime = new Date(+startAt);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue