All files / src/features/Underwriting/hooks useGetChallengesStats.tsx

100% Statements 3/3
100% Branches 0/0
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27              20x             15x     11x                  
import {
  GENERAL_STALE_TIME_15,
  PROVIDER_PANEL_KEYS,
} from "@features/Merchants/MerchantSidePanel/constants";
import { customInstance } from "@services/api";
import { useQuery } from "react-query";
 
export const useGetChallengesStats = ({
  merchantId,
}: {
  merchantId: number;
}) => {
  // /merchants/${merchant_id}/underwriting-challenges/stats
 
  return useQuery({
    queryKey: [PROVIDER_PANEL_KEYS.CHALLENGE_STATS, merchantId],
    queryFn: async ({ queryKey }) =>
      await customInstance({
        url: `/merchants/${merchantId}/underwriting-challenges/stats`,
        method: "GET",
      }),
    refetchOnMount: false,
    refetchOnWindowFocus: false,
    staleTime: GENERAL_STALE_TIME_15,
  });
};