fix search for segments, fix hooks endpoint for cohorts

This commit is contained in:
Francis Cao 2025-08-19 16:20:21 -07:00
parent 2f1f704728
commit 65024d4bf7
6 changed files with 43 additions and 10 deletions

View file

@ -11,7 +11,7 @@ export function RevenuePage({ websiteId }: { websiteId: string }) {
return (
<Column gap>
<WebsiteControls websiteId={websiteId} allowFilter={false} />
<WebsiteControls websiteId={websiteId} />
<Revenue websiteId={websiteId} startDate={startDate} endDate={endDate} />
</Column>
);

View file

@ -19,7 +19,7 @@ export function CohortDeleteButton({
const { formatMessage, labels } = useMessages();
const { del, useMutation } = useApi();
const { mutate, isPending, error } = useMutation({
mutationFn: () => del(`/websites/${websiteId}/cohorts/${cohortId}`),
mutationFn: () => del(`/websites/${websiteId}/segments/${cohortId}`),
});
const { touch } = useModified();

View file

@ -1,6 +1,6 @@
import { canUpdateWebsite, canViewWebsite } from '@/validations';
import { uuid } from '@/lib/crypto';
import { parseRequest } from '@/lib/request';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { segmentTypeParam, searchParams } from '@/lib/schema';
import { createSegment, getWebsiteSegments } from '@/queries';
@ -28,7 +28,9 @@ export async function GET(
return unauthorized();
}
const segments = await getWebsiteSegments(websiteId, type);
const filters = await getQueryFilters(query);
const segments = await getWebsiteSegments(websiteId, type, filters);
return json(segments);
}