aboutsummaryrefslogtreecommitdiff
path: root/src/components/hooks/queries/usePixelsQuery.ts
blob: c431179bb0edcee4ad117a35b47df8a029472e5e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import type { ReactQueryOptions } from '@/lib/types';
import { useApi } from '../useApi';
import { useModified } from '../useModified';
import { usePagedQuery } from '../usePagedQuery';

export function usePixelsQuery({ teamId }: { teamId?: string }, options?: ReactQueryOptions) {
  const { modified } = useModified('pixels');
  const { get } = useApi();

  return usePagedQuery({
    queryKey: ['pixels', { teamId, modified }],
    queryFn: pageParams => {
      return get(teamId ? `/teams/${teamId}/pixels` : '/pixels', pageParams);
    },
    ...options,
  });
}