'get data from another contract (solidity)

I'm new in developing contracts and i'm developing a React Dapp. in this context I have to get a list of details from another contract. here are the details : I have contract JobOffer which have a list of candidacy ( mapping(uint256 => address[]) idJobAddressCandidat; ) unit256 present the id of candidacy and those addresses are the addresses of candidate. the whole information of candidate is stocked by another contract called contract CVStorage this contract have a function which returns all the informations :

function getAllDetails(address _addressCandidat)
        public
        view
        returns (CV memory)
    {
        return CVs[_addressCandidat];

the problem is: I want to get the list of details for each address linked to an id of candidacy in the mapping ( returning a list of details of candidates in a candidacy) ; the signature of the function i want to develop is : getAllCandidaturesOfJobOffer(uint256 _idJobOffer) public view returns ( CV [] memory )

PS : I tried to get all those information from the front end (React) by getting the array of addresses of a candidacy using this function :

function getAllCandidaturesOfJobOffer(uint256 _idJobOffer)
        public
        view
        returns (address[] memory)
    {
        return idJobAddressCandidat[_idJobOffer];
    }

and then i get for each address the data from the other CVStorage contract ( using the function getAllDetails(address _addressCandidat) but unfortunately i got usually an error maybe because I shouldn't call two contracts in the same function or two await methods in the same function. thanks for giving me your time.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source