mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 21:57:16 +01:00
Unified loading states.
This commit is contained in:
parent
7b5591a3ce
commit
da8c7e99c5
52 changed files with 506 additions and 364 deletions
19
src/components/hooks/queries/useEventDataQuery.ts
Normal file
19
src/components/hooks/queries/useEventDataQuery.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { useApi } from '../useApi';
|
||||
import { useFilterParams } from '../useFilterParams';
|
||||
import { ReactQueryOptions } from '@/lib/types';
|
||||
|
||||
export function useEventDataQuery(
|
||||
websiteId: string,
|
||||
eventId: string,
|
||||
options?: ReactQueryOptions<any>,
|
||||
) {
|
||||
const { get, useQuery } = useApi();
|
||||
const params = useFilterParams(websiteId);
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['websites:event-data', { websiteId, eventId, ...params }],
|
||||
queryFn: () => get(`/websites/${websiteId}/event-data/${eventId}`, { ...params }),
|
||||
enabled: !!(websiteId && eventId),
|
||||
...options,
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue