Completed client side time adjustment handling

Corrected error display bug
Removed redundant auth and models in quiz client app
This commit is contained in:
2021-12-04 17:14:28 +00:00
parent c71e91326f
commit 9a2d738653
12 changed files with 64 additions and 54 deletions

View File

@ -126,14 +126,16 @@ function error_response(response) {
</div>
`);
} else if (response.responseJSON.error instanceof Array) {
var output = ''
for (var i = 0; i < response.responseJSON.error.length; i ++) {
$alert.html(`
output += `
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<i class="bi bi-exclamation-triangle-fill" title="Danger"></i>
${response.responseJSON.error[i]}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
`);
`;
$alert.html(output);
}
}
@ -205,25 +207,22 @@ $('.result-action-buttons').click(function(event){
// Script for Deleting Time Adjustment
$('.adjustment-delete').click(function(event){
var _id = $(this).data('_id');
var user_code = $(this).data('user_code');
var location = window.location.href;
location.replace('#', '')
location = location.replace('#', '')
console.log(location)
console.log(_id)
$.ajax({
url: location + 'delete-adjustment/',
type: 'POST',
data: JSON.stringify({'_id': _id}),
contentType: 'application/json',
success: function(response) {
window.location.reload();
},
error: function(response){
error_response(response);
},
});
$.ajax({
url: location + 'delete-adjustment/',
type: 'POST',
data: JSON.stringify({'user_code': user_code}),
contentType: 'application/json',
success: function(response) {
window.location.reload();
},
error: function(response){
error_response(response);
},
});
event.preventDefault();
});