mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 22:27:16 +01:00
Fixed event data queries.
This commit is contained in:
parent
0fd57aa7cf
commit
e11766ca1c
6 changed files with 44 additions and 38 deletions
|
|
@ -21,15 +21,19 @@ export default async (
|
|||
await useAuth(req, res);
|
||||
|
||||
if (req.method === 'GET') {
|
||||
const { websiteId, startAt, endAt, field, event } = req.query;
|
||||
const { websiteId, startAt, endAt, eventName } = req.query;
|
||||
|
||||
if (!(await canViewWebsite(req.auth, websiteId))) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const data = await getEventDataEvents(websiteId, new Date(+startAt), new Date(+endAt), {
|
||||
field,
|
||||
event,
|
||||
const startDate = new Date(+startAt);
|
||||
const endDate = new Date(+endAt);
|
||||
|
||||
const data = await getEventDataEvents(websiteId, {
|
||||
startDate,
|
||||
endDate,
|
||||
eventName,
|
||||
});
|
||||
|
||||
return ok(res, data);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,10 @@ export default async (
|
|||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const results = await getEventDataFields(websiteId, new Date(+startAt), new Date(+endAt));
|
||||
const startDate = new Date(+startAt);
|
||||
const endDate = new Date(+endAt);
|
||||
|
||||
const results = await getEventDataFields(websiteId, { startDate, endDate });
|
||||
|
||||
const data = results.reduce(
|
||||
(obj, row) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue