Remove redundant compare param definition

This commit is contained in:
AymanAlSuleihi 2026-01-09 22:54:50 +00:00
parent fbf03d6563
commit 6420f2c813

View file

@ -12,7 +12,6 @@ export async function GET(
) {
const schema = z.object({
...dateRangeParams,
compare: z.enum(['prev', 'yoy']).optional(),
...filterParams,
});
@ -32,11 +31,9 @@ export async function GET(
const data = await getWebsiteStats(websiteId, filters);
const { startDate, endDate } = getCompareDate(
filters.compare || 'prev',
filters.startDate,
filters.endDate,
);
const compare = filters.compare === 'yoy' ? 'yoy' : 'prev';
const { startDate, endDate } = getCompareDate(compare, filters.startDate, filters.endDate);
const comparison = await getWebsiteStats(websiteId, {
...filters,