vue.js - Axios GET request to PHP API not working with custom header
one text
Solution:
I think that in this part:
axios.interceptors.request.use(function (config) {
config.headers = {
'X-Api-Token': 'test'
};
return config;
});
you are overriding all the headers of the request. Try to add your header to the headers instead of override them, eg:
axios.interceptors.request.use(function (config) {
config.headers.token = "test";
return config;
});
Source