title: Make second api call when there is no error on the first using Axios in React
body: <p>I have three API calls which should be dependent on one another. The second API call should trigger only when the first succeeds.</p>
  <p>With my current implementation, I'm getting a CORS error when the first API call is made and was able to catch the error in the <code>catch</code> block. However, I'm seeing that the <em>second</em> and <em>third</em> APIs calls are made irrespective of the error that got caught in the <em>first</em> API call.</p>
  <p>Could anyone please advise?</p>
  <pre><code>const firstApiCall = async() =&gt; {
    try {
      await axios.post(
        process.env.FIRST_API,
        payload
      );
    ]
  } catch (err) {
    console.log(`err`, err);
  }
  };
  
  
  const secondApiCall = async() =&gt; {
    try {
      await axios.post(
        process.env.SECOND_API,
        payload
  
      }
    } catch (err) {
      console.log(`err`, err);
    }
  };
  
  const thirdApiCall = async() =&gt; {
    try {
      await axiosInstance.patch(
        process.env.THIRD_API,
        payload
      );
    } catch (err) {
      console.log('err', err);
    }
  };
  
  firstApiCall();
  secondApiCall();
  thirdApiCall();
  </code></pre>