All files / src/features/Merchants/MerchantSidePanel/Modals/ProviderConfigurationModal/hooks useGetEnterpriseConfigurationById.ts

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        27x       238x     24x              
import { UseQueryOptions, useQuery } from "react-query";
import { customInstance } from "@services/api";
import { QKEY_GET_ENTERPRISE_CONFIGURATIONS_BY_ID } from "@constants/queryKeys";
 
export const useGetEnterpriseConfigurationById = (
  enterpriseId: number,
  options?: Omit<UseQueryOptions<any, any, any, any>, "queryKey" | "queryFn">,
) => {
  return useQuery(
    [QKEY_GET_ENTERPRISE_CONFIGURATIONS_BY_ID, enterpriseId],
    async () =>
      await customInstance({
        url: `/enterprises/${enterpriseId}/configuration`,
        method: "GET",
      }),
    { enabled: Boolean(enterpriseId), ...options },
  );
};