tokenhttp
$axios.onRequest((config) => {
if (!config.headers.common) {
config.headers.common = {};
}
config.headers.common.token = config.headers.common.Authorization || "";
return config;
});
tokenhttp
$axios.onRequest((config) => {
if (!config.headers.common) {
config.headers.common = {};
}
config.headers.common.token = config.headers.common.Authorization || "";
return config;
});
service.interceptors.request.use(config => {
// Do something before request is sent
if (store.getters.token) {
config.headers[''] = store.getters.token;
}
return config;
}, error => {
// Do something with request error
//console.log(error); // for debug
Promise.reject(error);
})
this.axios.interceptors.request.use (function (config) {
config.headers['token'] = yourToken
return config;
}, function (err) {
return Promise.reject(error);
});
headers: {'X-Requested-With': 'XMLHttpRequest'},
Previous: Interception of nested arrays
Next: How to realize interworking between java according to Php Laravel bcrypt encryption and decryption