title: Pass data through promise .then notation using axios
body: <p>I need to make three web service calls. The second two calls depend on the results of the first. Then I want to resolve my promise with the results of all three server calls. Imagine I want to get all the players of a given sport. Using those players, I want to make a call to get a list of teams they play on, and I want to make a call to get the games they've played in. It looks something like this:</p>
  <pre><code>static doTheThing(sports) {
      return new Promise((resolve, reject) =&gt; {
       axios
          .post(&quot;http://localhost:8076/getPlayersForSports&quot;, sports)
          .then((res1) =&gt; {
            const playerNames = res1.data.map(player =&gt; player.name);
            return(axios.all([
              axios.post(&quot;http://localhost:8076/getTeams&quot;, playerNames),
              axios.post(&quot;http://localhost:8076/getGames&quot;, playerNames),
            ]));
          }).then(axios.spread((res2, res3) =&gt; {
            resolve( 
              res1.data
              res2.data, 
              res3.data)
          }))
          .catch((err)=&gt; {
            reject(err);
          })
      })
    }
  </code></pre>
  <p>I have gotten this far. I can get a list of players for a passed in list of sports. I can get the name off of every player object and use it to call the other two web services (I have confirmed the return is correct in the chrome dev console). This is where I am stuck. I am using axios.all() to chain the second two commands and then axios.spread() as I have seen in some other responses. I cant figure out how to pass res1 through the chain so that I can resolve with all three data sets.</p>