title: Axios: how to cancel request inside request interceptor properly?
body: <p>I want to cancel the request if there's no token, so I do like this:</p>
  <pre class="lang-js prettyprint-override"><code>instance.interceptors.request.use(config =&gt; {
    if (!getToken()) {
      console.log(&quot;interceptors: no access token&quot;);
    } else {
      config.headers.Authorization = &quot;Bearer &quot; + getToken().accessToken;
      return config;
    }
  });
  </code></pre>
  <p>But in negative scenario there's an error <code>TypeError: Cannot read property 'cancelToken' of undefined</code>.</p>