In my JS I am doing:
import axios from 'axios';
Then i’m using axios in the usual fashion.
But i’ve also seen this in the bootstrap file that comes with Laravel:
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
-
As I am importing axios again I presume that I am not using the bootstrap version of axios with the default headers config?
-
What is the purpose of this config?
-
If I want to use the bootstrap version of axios, instead of importing it to my file, should I do window.axios to make a axios call?