title: Making 2 sequential requests with Axios - second request depends on the response of 1st
body: <p>The following code is not waiting for the <code>else</code> part to return data before resolving.</p>
  <p>Where I'm going wrong with this code?</p>
  <pre><code>return request.get(`${&lt;URL1&gt;}`)
  .then((res) =&gt; {
      if (res1.data[0]) {
          data1 = res.data[0]};
      } else {
          request.get(`${&lt;URL2&gt;`)
              .then((res2) =&gt; {
                  data1 = res2.data
              });
      }
      return Promise.resolve(data1);
  })
  </code></pre>
  <p>Thanks in advance.</p>
  <p>San</p>