axios/plugin.js - $axios.setToken errors

awronski
351
awronski
commented 3 years ago

Hi!

I try to set token in the store action:

 actions: {
    async setAuthToken ({ state, commit }, { authToken, $axios }) {
      $axios.setToken(authToken, 'Bearer')
      [...]
  }

But there is an error ReferenceError: value is not defined
About this line of code:
https://github.com/nuxt-community/modules/blob/master/modules/axios/plugin.js#L68

But even if I fix it then there is error here:
https://github.com/nuxt-community/modules/blob/master/modules/axios/plugin.js#L63

Cannot read property 'defaults' of undefined.

bug
0
pi0
39.8k
pi0
commented 3 years ago

Hi. Thanks for the report. This seems from a recent refactor for adding setHeader function. Please upgrade to @nuxtjs/axios:2.2.1

0
awronski
351
awronski
commented 3 years ago

Thanks for the quick fix!

0
Informations
Bug Report โ€ข Open
#c20 - Created 3 years ago