[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.
24 lines
620 B
JavaScript
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();
|
|
},
|
|
});
|
|
});
|
|
}
|
|
});
|