Hi, I need to set the user's token before making a request via axios. Now axios is added as a plugin just like how it is shown in the docs. The api's are in another server which needs the users token. I need to add this to the authorisation header for every request like this
axios.defaults.headers.common['Authorization'] = 'JWT ' + token;
This token is present in the req obj and is added to the store via middleware. I can't add it to the env because token is different for each user;
Is there any way to access the store or the req obj while a plugin is getting initialised? If not what are the other ways to achieve this
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c260">#c260</a>)</em></sub></div>