* fix: multi lines and spaces issues * fix: eslint operator-linebreak issue * fix: eslint quotes issue * fix: remaining quotes issues * fix: eslint object curly newline issue * fix: eslint object curly spacing issue * fix: eslint brace-style issues * fix: react jsx indent and props issues * fix: eslint trailing spaces issues * fix: eslint linbreak style issue * fix: eslint space unary operator issue * fix: eslint line around directives issue * fix: void and typeof space unary ops issue
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
(function(define) {
|
|
'use strict';
|
|
|
|
define(['jquery', 'backbone'],
|
|
function($, Backbone) {
|
|
return Backbone.Model.extend({
|
|
defaults: {
|
|
email: ''
|
|
},
|
|
ajaxType: '',
|
|
urlRoot: '',
|
|
|
|
initialize: function(attributes, options) {
|
|
this.ajaxType = options.method;
|
|
this.urlRoot = options.url;
|
|
},
|
|
|
|
sync: function(method, model) {
|
|
var headers = {
|
|
'X-CSRFToken': $.cookie('csrftoken')
|
|
};
|
|
|
|
// Only expects an email address.
|
|
$.ajax({
|
|
url: model.urlRoot,
|
|
type: model.ajaxType,
|
|
data: model.attributes,
|
|
headers: headers,
|
|
success: function() {
|
|
model.trigger('sync');
|
|
},
|
|
error: function(error) {
|
|
model.trigger('error', error);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
});
|
|
}).call(this, define || RequireJS.define);
|