Level 63
These lines are needed to automatically send the X-XSRF-TOKEN header with each response, so that you don't need to send it manually.
2 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Could someone please explain to me what this is doing in bootstrap and do I need it?
import axios from 'axios'; //not this
window.axios = axios; //not this
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; //this
These lines are needed to automatically send the X-XSRF-TOKEN header with each response, so that you don't need to send it manually.
Please or to participate in this conversation.