* 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
34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
(function(define) {
|
|
'use strict';
|
|
|
|
define(['jquery', 'jquery.cookie'], function($) {
|
|
var EmailOptInInterface = {
|
|
|
|
urls: {
|
|
emailOptInUrl: '/api/user/v1/preferences/email_opt_in/'
|
|
},
|
|
|
|
headers: {
|
|
'X-CSRFToken': $.cookie('csrftoken')
|
|
},
|
|
|
|
/**
|
|
* Set the email opt in setting for the organization associated
|
|
* with this course.
|
|
* @param {string} courseKey Slash-separated course key.
|
|
* @param {string} emailOptIn The preference to opt in or out of organization emails.
|
|
*/
|
|
setPreference: function(courseKey, emailOptIn) {
|
|
return $.ajax({
|
|
url: this.urls.emailOptInUrl,
|
|
type: 'POST',
|
|
data: {course_id: courseKey, email_opt_in: emailOptIn},
|
|
headers: this.headers
|
|
});
|
|
}
|
|
};
|
|
|
|
return EmailOptInInterface;
|
|
});
|
|
}).call(this, define || RequireJS.define);
|