title: Vuex store authentication and axios interceptor returns undefinied
body: <p>Scratching my head on this issue. I do all the authentication logic in my vuex store. When using an axios interceptor to catch the error, it always returns undefined. When I only perform the interceptor on other calls, it works fine. (did this by adding if(token) { api.interceptor...}</p>
  <p>My code is as follow</p>
  <p>store/index.js</p>
  <pre><code>      return new Promise((resolve, reject) =&gt; {
          commit('auth_request')
          api({url: '/api/auth/login', data: user, method: 'POST' })
          .then((resp) =&gt; {
            let token = resp.data.token
            //let sites = JSON.stringify(resp.data.sites)
            let user = JSON.stringify(resp.data.user)
            localStorage.setItem('token', token)
            api.defaults.headers.common['Authorization'] = 'Bearer ' + token
            commit('auth_success', token)
            //commit('set_sites', sites)
            commit('set_default', resp.data.user.default_site)
            commit('set_user', user)
            resolve(resp)
          })
          .catch((err) =&gt; {
            commit('auth_error', err)
            reject(err)
          })
        })
      }, 
  </code></pre>
  <p>axios.js</p>
  <pre><code>import axios from 'axios'
  import store from 'src/store'
  
  let token = localStorage.getItem('token')
  
  const api = axios.create({ baseURL: 'http://127.0.0.1:8000/' })
  
  api.interceptors.response.use(response =&gt; {
    console.log('ok')
    return response;
  }, error =&gt; {
    if (error.response.status === 401) {
      store.dispatch('log_out')
    }
    return error
  });
  </code></pre>
  <p>Login.vue</p>
  <pre><code>          this.loading = true
            this.$store.dispatch('login', this.user)
            .then(() =&gt; {
              this.loading = false
              this.$router.push('/')
               
            })
            .catch(error =&gt; {
                 this.loading = false
                  this.errorMessage = error.response.data.message
            })
        },```
  
  
  Dont be hard on me, junior in this ;-)
  </code></pre>