JS fixes for when we get a 419

This commit is contained in:
Deon George 2023-03-02 09:56:09 +11:00
parent ee556582d2
commit 4767eb3a4f
2 changed files with 16 additions and 3 deletions

17
public/js/custom.js vendored
View File

@ -42,8 +42,21 @@ $(document).ready(function() {
}).done(function(html) { }).done(function(html) {
$('.main-content').empty().append(html); $('.main-content').empty().append(html);
}).fail(function() { }).fail(function(item) {
alert('Failed'); switch(item.status) {
case 404:
$('.main-content').empty().append(item.responseText);
break;
case 419:
alert('Session has expired, reloading the page and try again...');
location.reload();
break;
case 500:
$('.main-content').empty().append(item.responseText);
break;
default:
alert(item.status+': Well that didnt work?');
}
}); });
} }
}, },

View File

@ -80,7 +80,7 @@
$('.main-content').empty().append(html); $('.main-content').empty().append(html);
}).fail(function() { }).fail(function() {
//alert('Failed'); alert('Well that didnt work?');
}); });
e.stopPropagation(); e.stopPropagation();