mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 23:27:12 +01:00
Updated method for getting event types.
This commit is contained in:
parent
7921893c1d
commit
083ef2dc9c
3 changed files with 8 additions and 88 deletions
|
|
@ -1,25 +0,0 @@
|
|||
import { getEventTypes } from 'lib/queries';
|
||||
import { ok, methodNotAllowed, unauthorized } from 'lib/response';
|
||||
import { allowQuery } from 'lib/auth';
|
||||
|
||||
export default async (req, res) => {
|
||||
if (req.method === 'GET') {
|
||||
if (!(await allowQuery(req))) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const { id, start_at, end_at, url } = req.query;
|
||||
|
||||
const websiteId = +id;
|
||||
const startDate = new Date(+start_at);
|
||||
const endDate = new Date(+end_at);
|
||||
|
||||
const eventTypes = await getEventTypes(websiteId, startDate, endDate, undefined, undefined, {
|
||||
url,
|
||||
});
|
||||
|
||||
return ok(res, eventTypes);
|
||||
}
|
||||
|
||||
return methodNotAllowed(res);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue