title: Axios async/await flow
body: <p>I'm dipping my toe into the waters of Axios and async/await at the same time, and am trying to understand something about the control flow. Is the following legitimate?</p>
  <pre><code>let loading=true;
  (async() =&gt; {
    let response = null;
    try {
      response = await axios.get('https://whatever.com/api');
    } finally {
      loading=false;
    }
    if(response){
      //do something with response here
    }
    
    
  })();
  </code></pre>
  <p>That is, can I count on the request to have returned at the point I am accessing the response variable? I appreciate I could guarantee it is by moving it into the 'try' immediately after the axios get, but then I would have to have the <code>loading=false</code> line before it, as well as in 'finally' (or 'catch'). I need to ensure that loading is set to false before any further actions, whether the request succeeds or fails, and I don't want to repeat myself. Maybe there's a better way of doing this?</p>