Files
edx-platform/lms/static/js/learner_dashboard/certificate_api.js
Albert (AJ) St. Aubin 26678daf1f feat: Add the Request Certificate button to a Course card
[MICROBA-678]

When a certificate is in an unexpected state (i.e. notpassing with a
passing grade) this alert will allow the user to attempt to resolve the
issue on their own. It will run the code that checks the certificates
status. It requires that the course is configured to allow users to
Request Certificates though.
2021-07-15 10:27:18 -04:00

24 lines
620 B
JavaScript

$(document).ready(() => {
'use strict';
const requestButtons = document.getElementsByClassName('request-cert');
for (let i = 0; i < requestButtons.length; i++) {
requestButtons[i].addEventListener('click', (event) => {
event.preventDefault();
const endpoint = !!event.target.dataset.endpoint && event.target.dataset.endpoint;
$.ajax({
type: 'POST',
url: endpoint,
dataType: 'text',
success: () => {
location.reload();
},
error: (jqXHR, textStatus, errorThrown) => {
location.reload();
},
});
});
}
});