How does promise.all pass on both data?

    getLatestJob(context){

         const result1=api.getJobJsonFromShield(context);
         const result2=api.getJobJson(context);
         Promise.all([result1,result2]).then(function(results){

    return {

      "shielddata":results[0], //response
      "nbudata":results[1]
    }
}).then(function(responses){return responses["shielddata"].json()



}).then(function(json){
  console.log(json)
}

I want to get both data and execute the corresponding mutation respectively. The first return can get two response objects, and then how to get the json-sharp-sharp-sharp problem description


can you do a good job in typesetting first?

guess:

getLatestJob(context){
  const result1=api.getJobJsonFromShield(context)
    .then(response => {
      return response.json();
    });
  const result2=api.getJobJson(context)
    .then(response => {
      return response.json();
    });
  Promise.all([result1, result2])
    .then(([shieldData, nbuData]) {
      
    });
}    
Menu