mirror of
https://github.com/umami-software/umami.git
synced 2026-02-20 04:25:39 +01:00
add event data
This commit is contained in:
parent
67394194af
commit
75778fdfc7
22 changed files with 446 additions and 84 deletions
|
|
@ -4,8 +4,6 @@ import { ok, badRequest, methodNotAllowed, unauthorized } from 'next-basics';
|
|||
import { allowQuery } from 'lib/auth';
|
||||
import { useAuth, useCors } from 'lib/middleware';
|
||||
|
||||
const unitTypes = ['year', 'month', 'hour', 'day'];
|
||||
|
||||
export default async (req, res) => {
|
||||
await useCors(req, res);
|
||||
await useAuth(req, res);
|
||||
|
|
@ -15,18 +13,11 @@ export default async (req, res) => {
|
|||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const {
|
||||
website_id: websiteId,
|
||||
start_at,
|
||||
end_at,
|
||||
unit,
|
||||
timezone,
|
||||
event_name: eventName,
|
||||
columns,
|
||||
filters,
|
||||
} = req.body;
|
||||
const { id: websiteId } = req.query;
|
||||
|
||||
if (!moment.tz.zone(timezone) || !unitTypes.includes(unit)) {
|
||||
const { start_at, end_at, timezone, event_name: eventName, columns, filters } = req.body;
|
||||
|
||||
if (!moment.tz.zone(timezone)) {
|
||||
return badRequest(res);
|
||||
}
|
||||
|
||||
|
|
@ -37,7 +28,6 @@ export default async (req, res) => {
|
|||
startDate,
|
||||
endDate,
|
||||
timezone,
|
||||
unit,
|
||||
eventName,
|
||||
columns,
|
||||
filters,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@ export default function LoginPage({ loginDisabled }) {
|
|||
|
||||
export async function getServerSideProps() {
|
||||
return {
|
||||
props: { loginDisabled: !!process.env.DISABLE_LOGIN || process.env.isCloudMode },
|
||||
props: { loginDisabled: !!process.env.DISABLE_LOGIN || !!process.env.isCloudMode },
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue