Skip to content

Instantly share code, notes, and snippets.

@shafi-shaikat
Forked from skwp/cookie.js
Created October 5, 2017 12:35
Show Gist options
  • Save shafi-shaikat/6c58cc0618d1e1439bcbb04c5722c862 to your computer and use it in GitHub Desktop.
Save shafi-shaikat/6c58cc0618d1e1439bcbb04c5722c862 to your computer and use it in GitHub Desktop.
import Ember from 'ember';
import getCookie from 'cookie';
export default {
name: "csrf",
initialize: function() {
Ember.$.ajaxPrefilter(function(options, originalOptions, xhr) {
var token = getCookie("X-CSRF-TOKEN");
xhr.setRequestHeader("X-CSRF-Token", token);
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment