import { useQuery } from '@tanstack/react-query';

import { dareQueryKeys } from '../dare-query-keys';
import { dareApi, type PostGetListDareReturn } from '../dare-api';

import type { BaseAxiosError } from '../../../../types';

export const useGetListDareQuery = (enabled: boolean) => {
  return useQuery<PostGetListDareReturn, BaseAxiosError>({
    queryKey: dareQueryKeys.getListDare(),
    queryFn: async () => {
      const response = await dareApi.getListDare();
      return response.data;
    },
    enabled
  });
};
