forked from OpenNeo/impress
Emi Matchu
0e314482f7
I haven't been running Prettier consistently on things in this project. Now, it's quick-runnable, and I've got it on everything! Also, I just think tabs are the right default for this kind of thing, and I'm glad to get to switch over to it! (In `package.json`.)
20 lines
458 B
JavaScript
20 lines
458 B
JavaScript
(function () {
|
|
var CSRFProtection;
|
|
var token = $('meta[name="csrf-token"]').attr("content");
|
|
if (token) {
|
|
CSRFProtection = function (xhr, settings) {
|
|
var sendToken =
|
|
typeof settings.useCSRFProtection === "undefined" || // default to true
|
|
settings.useCSRFProtection;
|
|
if (sendToken) {
|
|
xhr.setRequestHeader("X-CSRF-Token", token);
|
|
}
|
|
};
|
|
} else {
|
|
CSRFProtection = $.noop;
|
|
}
|
|
|
|
$.ajaxSetup({
|
|
beforeSend: CSRFProtection,
|
|
});
|
|
})();
|