mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 15:47:13 +01:00
Renamed query hooks. Fixed conversion bugs.
This commit is contained in:
parent
adca3c36d0
commit
7886c3f393
110 changed files with 423 additions and 489 deletions
20
src/components/hooks/queries/useWebsiteEventsQuery.ts
Normal file
20
src/components/hooks/queries/useWebsiteEventsQuery.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { useApi } from '../useApi';
|
||||
import { UseQueryOptions } from '@tanstack/react-query';
|
||||
import { useFilterParams } from '../useFilterParams';
|
||||
import { usePagedQuery } from '../usePagedQuery';
|
||||
|
||||
export function useWebsiteEventsQuery(
|
||||
websiteId: string,
|
||||
options?: Omit<UseQueryOptions, 'queryKey' | 'queryFn'>,
|
||||
) {
|
||||
const { get } = useApi();
|
||||
const params = useFilterParams(websiteId);
|
||||
|
||||
return usePagedQuery({
|
||||
queryKey: ['websites:events', { websiteId, ...params }],
|
||||
queryFn: pageParams =>
|
||||
get(`/websites/${websiteId}/events`, { ...params, ...pageParams, pageSize: 20 }),
|
||||
enabled: !!websiteId,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue