Details page.

This commit is contained in:
Mike Cao 2020-07-31 19:05:14 -07:00
parent 5b45301178
commit ac2612924e
12 changed files with 312 additions and 10 deletions

View file

@ -2,12 +2,14 @@ import moment from 'moment-timezone';
import { getPageviewData } from 'lib/db';
import { useAuth } from 'lib/middleware';
const unitTypes = ['month', 'hour', 'day'];
export default async (req, res) => {
await useAuth(req, res);
const { id, start_at, end_at, unit, tz } = req.query;
if (!moment.tz.zone(tz) || !['month', 'hour', 'day'].includes(unit)) {
if (!moment.tz.zone(tz) || !unitTypes.includes(unit)) {
return res.status(400).end();
}