MCPcopy
hub / github.com/umami-software/umami / useDateRangeQuery

Function useDateRangeQuery

src/components/hooks/queries/useDateRangeQuery.ts:9–23  ·  view source on GitHub ↗
(websiteId: string, options?: ReactQueryOptions)

Source from the content-addressed store, hash-verified

7};
8
9export function useDateRangeQuery(websiteId: string, options?: ReactQueryOptions) {
10 const { get, useQuery } = useApi();
11
12 const { data } = useQuery<DateRange>({
13 queryKey: ['date-range', websiteId],
14 queryFn: () => get(`/websites/${websiteId}/daterange`),
15 enabled: !!websiteId,
16 ...options,
17 });
18
19 return {
20 startDate: data?.startDate ? new Date(data.startDate) : null,
21 endDate: data?.endDate ? new Date(data.endDate) : null,
22 };
23}

Callers 1

WebsiteDateFilterFunction · 0.90

Calls 2

useApiFunction · 0.90
getFunction · 0.50

Tested by

no test coverage detected