Sha256: 89b8b6ef9c4517f69ba8ffcda0deaff1fd1038b72dd82d7da99c48978f7ef9f3
Contents?: true
Size: 751 Bytes
Versions: 137
Compression:
Stored size: 751 Bytes
Contents
Backbone.ajax = Spree.ajax; Backbone._sync = Backbone.sync; Backbone.sync = function(method, model, options) { var beforeSend = options.beforeSend; options.beforeSend = function(xhr) { var token = $('meta[name="csrf-token"]').attr('content'); if (token) { xhr.setRequestHeader('X-CSRF-Token', token); } if (beforeSend) { return beforeSend.apply(this, arguments); } }; if (options.data == null && model && model.paramRoot && (method === 'create' || method === 'update' || method === 'patch')) { options.contentType = "application/json"; var data = {}; data[model.paramRoot] = model.toJSON(options); options.data = JSON.stringify(data); } return Backbone._sync(method, model, options); };
Version data entries
137 entries across 137 versions & 2 rubygems