Files
edx-platform/lms/static/js/student_account/emailoptin.js
Jayram 5a9e12dd96 [ADD] user account registration endpoint for api-docs
Added alias for /user_api endpoints

FIX quality violations

IMPROVED urls_common for readability

Removed redundant URL entry from urls_common file
2021-01-15 03:59:16 +00:00

33 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);