mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 15:17:23 +01:00
refactor views and queries for dashboard
This commit is contained in:
parent
bfd5c5f150
commit
f518066d93
7 changed files with 34 additions and 43 deletions
|
|
@ -56,7 +56,7 @@ export default async (
|
|||
await useAuth(req, res);
|
||||
await useValidate(schema, req, res);
|
||||
|
||||
const { websiteId, compare } = req.query;
|
||||
const { websiteId, compare, unit } = req.query;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
if (!(await canViewWebsite(req.auth, websiteId))) {
|
||||
|
|
@ -72,9 +72,13 @@ export default async (
|
|||
|
||||
const filters = getRequestFilters(req);
|
||||
|
||||
const metrics = await getWebsiteStats(websiteId, { ...filters, startDate, endDate });
|
||||
const metrics = await getWebsiteStats(websiteId, unit as string, {
|
||||
...filters,
|
||||
startDate,
|
||||
endDate,
|
||||
});
|
||||
|
||||
const prevPeriod = await getWebsiteStats(websiteId, {
|
||||
const prevPeriod = await getWebsiteStats(websiteId, unit as string, {
|
||||
...filters,
|
||||
startDate: compareStartDate,
|
||||
endDate: compareEndDate,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue