title: axios keeps returnin 401 when renewing token
body: <p>I am having issues after renewing the token to re-execute the original request.
  Basically, after the new token has been obtained and properly set, when I try to execute the original request I keep getting <strong>Request failed with status code 401</strong>.</p>
  
  <p>I am sure I am messing up the promise, but I can't realize where the problem is</p>
  
  <pre><code>// axiosWrapper.js
  
  import axios from 'axios';
  import authenticationApi from './authentication';
  
  const baseURL = 'http://apiurl/';
  const axiosWrapper = axios.create({
    baseURL,
  });
  
  axiosWrapper.interceptors.response.use(
    response =&gt; response,
    error =&gt; {
      if (error.response.status === 401) {
        return authenticationApi.auth()
          .then(res =&gt; {
            if (res.status === 200) {
              setToken(res.data.token);
              return axios.request(error.config);
            }
          })
          .catch(err =&gt; {
            console.log(err); // Request failed with status code 401
          });
      }
  
      return Promise.reject(error);
    },
  );
  
  axiosWrapper.interceptors.request.use(async config =&gt; {
    if (config.url === '/auth') {
      return config;
    }
  
    var token = await getToken();
    config.headers.Authorization = token ? 'Bearer ${token}' : '';
  
    return config;
  });
  
  export default axiosWrapper;
  
  </code></pre>
  
  <pre><code>// authentication.js
  import axiosWrapper from './axiosWrapper';
  
  export default {
    auth: () =&gt; axiosWrapper.post('auth', {apiKey: 'apiKey'}),
  };
  
  </code></pre>