aboutsummaryrefslogtreecommitdiff
path: root/src/components/hooks/queries/usePixelQuery.ts
blob: 7fd83c2748970bd0393a816b77f8345eb0296cd5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { useApi } from '../useApi';
import { useModified } from '../useModified';

export function usePixelQuery(pixelId: string) {
  const { get, useQuery } = useApi();
  const { modified } = useModified(`pixel:${pixelId}`);

  return useQuery({
    queryKey: ['pixel', { pixelId, modified }],
    queryFn: () => {
      return get(`/pixels/${pixelId}`);
    },
    enabled: !!pixelId,
  });
}