mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 05:37:20 +01:00
Added segment filtering to filter form.
This commit is contained in:
parent
2e69e57445
commit
2ad624ccc8
15 changed files with 301 additions and 193 deletions
21
src/components/hooks/queries/useWebsiteSegementsQuery.ts
Normal file
21
src/components/hooks/queries/useWebsiteSegementsQuery.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { useApi } from '../useApi';
|
||||
import { useModified } from '@/components/hooks';
|
||||
import { keepPreviousData } from '@tanstack/react-query';
|
||||
import { ReactQueryOptions } from '@/lib/types';
|
||||
|
||||
export function useWebsiteSegmentsQuery(
|
||||
websiteId: string,
|
||||
params?: Record<string, string>,
|
||||
options?: ReactQueryOptions<any>,
|
||||
) {
|
||||
const { get, useQuery } = useApi();
|
||||
const { modified } = useModified(`website:${websiteId}`);
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['website:segments', { websiteId, modified, ...params }],
|
||||
queryFn: () => get(`/websites/${websiteId}/segments`, { ...params }),
|
||||
enabled: !!websiteId,
|
||||
placeholderData: keepPreviousData,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue