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
You should not set axios headers in the plugin because it change for every users.
@alexchopin Good to know that this will be added to the next version. When are you planning to release the next version?
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
You should not set axios headers in the plugin because it change for every users.