0
I make 3 HTTPS nodejs requests to an API also in Node, each Promise performs a task and these Promises I am passing several information on their body, one of these information needs to be an ID. Running a Promise all, with the 3 Promises, the Promise example_2 returns me an ID and I want to pass this ID to the Promise example_3, returning the result I need. So the result of Promise all has to be from Promise example_3. And I have no idea how to do that!
let example_3 = () =>{
return new Promise( ( resolve, reject ) =>{
try{
request({
method:'post',
body:'AQUI PRECISO DO ID DO EXAMPLE_2'
},error(.....
//Executo todas promises
let exect = async () => {
let responses = await Promise.all([example_1,example_2,example_3])
let responseJson = JSON.parse(responses[1]);
//o id da promise example_2
let idExample2 = JSON.parse(responseJson.data.filter_value);
}
The id I want to pass to the file EXAMPLE_2 is in the variable idResp. Could someone guide me?
tries to improve the body of your question, which technology you use, is a bank? a JSON document? This is not clear leave all possible information. which type of bank is a bank and what exactly has in this bank model, all this has to be passed.
– Teuuz1994
thanks @Teuuz1994, I will improve the question
– ThiMoreira