Skip to content

Instantly share code, notes, and snippets.

@skwp
Last active October 5, 2017 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save skwp/f0d09dc9adac07e597bf to your computer and use it in GitHub Desktop.
Save skwp/f0d09dc9adac07e597bf 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