competitions/templates/index.html [855:885]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
})
};
fetch(updateEndpoint, requestOptions)
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
if (data.success) {
// Optionally, display a success message or handle accordingly
console.log('Update successful');
articleLoadingSpinner.classList.add('hidden');
} else {
// Handle failure case
console.log('Update failed');
articleLoadingSpinner.classList.add('hidden');
alert(data.error);
}
// Refresh submissions display
fetchAndDisplaySubmissions();
})
.catch(error => {
console.error('There was a problem with the fetch operation for updating:', error);
});
}