All files / src/features/Merchants/MerchantSidePanel/hooks useFetchMerchantRisk.ts

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

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                                               
import { useQuery } from "react-query";
import {
  GENERAL_STALE_TIME_15,
  MERCHANT_SIDE_PANEL_PREVIEW_API_KEYS,
} from "../constants";
import { customInstance } from "@services/api";
 
export default function useFetchMerchantRisk(category: number | null) {
  return useQuery(
    [MERCHANT_SIDE_PANEL_PREVIEW_API_KEYS.GET_RISK_CATEGORY, category],
    async () => {
      return customInstance({
        url: `/merchant-risk-statuses?filter=category:%22${category}%22`,
      });
    },
    {
      enabled: Boolean(category),
      refetchOnWindowFocus: false,
      refetchOnMount: false,
      staleTime: GENERAL_STALE_TIME_15,
    },
  );
}