Skip to content

Commit

Permalink
Merge pull request #105 from jenky/master
Browse files Browse the repository at this point in the history
Remove manual adding of X-CSRF-TOKEN header (laravel#5083)
  • Loading branch information
jenky committed Aug 23, 2019
2 parents bcdc814 + aa74fcb commit 9f5a19d
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions resources/js/bootstrap.js
Expand Up @@ -23,20 +23,6 @@ window.axios = require('axios');

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

/**
* Next we will register the CSRF Token as a common header with Axios so that
* all outgoing HTTP requests automatically have it attached. This is just
* a simple convenience so we don't have to attach every token manually.
*/

let token = document.head.querySelector('meta[name="csrf-token"]');

if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
}

/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
Expand Down

0 comments on commit 9f5a19d

Please sign in to comment.