import { useQuery } from 'react-query';

import { iconsKeys } from 'src/queries/icons';
import { getPublicIcons } from 'src/services/icons';

export const usePublicIcons = () => {
  const { data: icons, ...query } = useQuery({
    queryKey: iconsKeys.public(),
    queryFn: getPublicIcons,
    select: response => response?.data,
  });

  return { icons: icons ?? [], ...query };
};
