I want to set a header that sent with each request:
axios.defaults.headers.common = {
Accept: 'application/json',
'X-CSRF-TOKEN': store.state.csrf
};
This is only evaluated at the page load. I would like it to be dynamic since the csrf value may change later on. Something like:
axios.defaults.headers.common = {
Accept: 'application/json',
'X-CSRF-TOKEN': () => store.state.csrf
};
However this does not work.