title: Get response from axios with await/async
body: <p>I'm trying to get JSON object from <strong>axios</strong></p>
  
  <pre><code>'use strict'
  
  async function getData() {
      try {
          var ip = location.host;
          await axios({
              url: http() + ip + '/getData',
              method: 'POST',
              timeout: 8000,
              headers: {
                  'Content-Type': 'application/json',
              }
          }).then(function (res) {
              console.dir(res); // we are good here, the res has the JSON data
              return res; 
          }).catch(function (err) {
              console.error(err);
          })
      }
      catch (err) {
          console.error(err);
      }
  }
  </code></pre>
  
  <p>Now I need to fetch the <strong>res</strong></p>
  
  <pre><code>let dataObj;
  getData().then(function (result) {
      console.dir(result); // Ooops, the result is undefined
      dataObj = result;
  });
  </code></pre>
  
  <p>The code is blocking and waits for the result, but I'm getting undefined instead of object</p>