0👍
OK, the problem comes from axios.get
I don’t know why, but it works when I use axios.create()
and use intercepter
to add headers with Authorization Token for every request.
Then I call axios_instance.get
and then I can send my Token via headers.
- [Vuejs]-Ionic Vue pass Object via router-link
- [Vuejs]-File upload field not resetting after a successful submission in VueJS
0👍
Remove
SIMPLE_JWT = {
'AUTH_HEADER_TYPES': ('Bearer',),
}
then call the function like this
test_auth: function(){
var accessToken = this.$store.state.accessToken;
console.log(accessToken);
axios.get('http://django:8000/api/uvs/',{headers:{
'Authorization':`Token ${accessToken}`,
}} )
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error.response.data);
});
},
- [Vuejs]-How can I change the locale of a VueI18n instance in a Vue file, and have it apply to all other Vue files in the application?
- [Vuejs]-How to update a table's data in VueJS?
Source:stackexchange.com