New schema for pixels and links.
This commit is contained in:
19
src/components/hooks/queries/usePixelsQuery.ts
Normal file
19
src/components/hooks/queries/usePixelsQuery.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useApi } from '../useApi';
|
||||
import { usePagedQuery } from '../usePagedQuery';
|
||||
import { useModified } from '../useModified';
|
||||
import { ReactQueryOptions } from '@/lib/types';
|
||||
|
||||
export function usePixelsQuery(
|
||||
{ websiteId, type }: { websiteId: string; type?: string },
|
||||
options?: ReactQueryOptions<any>,
|
||||
) {
|
||||
const { modified } = useModified(`pixels:${type}`);
|
||||
const { get } = useApi();
|
||||
|
||||
return usePagedQuery({
|
||||
queryKey: ['pixels', { websiteId, type, modified }],
|
||||
queryFn: async () => get('/pixels', { websiteId, type }),
|
||||
enabled: !!websiteId && !!type,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user