Controllers+Views+JS+Route: Implement cache purging

This commit is contained in:
Riyyi
2021-08-30 00:45:57 +02:00
parent b244b625ab
commit d50443b10a
4 changed files with 135 additions and 7 deletions
+34
View File
@@ -229,6 +229,40 @@ $(document).ready(function() {
//------------------------------------------
$('.js-purge').on('click', function(event)
{
event.preventDefault();
const purgeType = $(this).attr('data-type');
const csrfToken = $(this).attr('data-token');
if (!confirm('Are you sure you want to continue?')) {
return;
}
$.ajax({
url: $(this).attr('href'),
type: 'POST',
data: { type: purgeType, _token: csrfToken },
success: function(data)
{
if (data == '') {
alert("Cache could not be purged!");
return;
}
const response = JSON.parse(data);
if (response.success == false) {
console.log(data);
alert("Cache could not be purged!");
return;
}
alert("Cache has been purged.");
}
});
});
// Developer mode
$('#development-mode').on('click', function(e)
{