All files / src/hooks/acquirer-api/settings/business-details useListBusinessOwners.ts

87.5% Statements 7/8
75% Branches 3/4
100% Functions 2/2
87.5% Lines 7/8

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 28 29        3x 184x 184x   19x         19x   19x           184x              
import { useGetBusinessOwners } from "@services/api/business-owners";
import { TBusinessOwner } from "@common/BusinessOwners/types";
import { useParseBO } from "@components/ProfilePage/BusinessProfileSetupNew/helpers/refineData";
 
const useListBusinessOwners = (legalEntityID: number) => {
  const { parseBO } = useParseBO();
  const { data, isLoading } = useGetBusinessOwners(legalEntityID, {
    parser: (response: any) => {
      Iif (!response)
        return {
          total: 0,
          data: [],
        };
      const parsedData = response?.data?.map(parseBO);
 
      return {
        total: response?.total,
        data: parsedData,
      };
    },
  });
  return {
    owners: (data?.data || []) as TBusinessOwner[],
    isLoading,
  };
};
 
export default useListBusinessOwners;