fix: Stop polling enhanced apps when api returns error

This commit is contained in:
Attila Kerekes
2022-11-17 18:00:35 +01:00
committed by Attila Jozsef Kerekes
parent f9280cd4c0
commit 48616e87bd
4 changed files with 21 additions and 8 deletions

13
public/js/app.js vendored
View File

@@ -588,8 +588,13 @@ $.when($.ready).then(function () {
if (timer < max_timer) timer += 2000;
}
},
complete: function complete() {
// Schedule the next request when the current one's complete
complete: function complete(jqXHR) {
if (jqXHR.status > 299) {
// Stop polling when we get errors
return;
} // Schedule the next request when the current one's complete
livestatsRefreshTimeouts[index] = window.setTimeout(worker, timer);
}
});
@@ -696,10 +701,10 @@ $.when($.ready).then(function () {
$('.add-item').hide();
$('.item-edit').hide();
$('#app').removeClass('sidebar');
$('#sortable .tooltip').css('display', '')
$('#sortable .tooltip').css('display', '');
$('#sortable').sortable('disable');
} else {
$('#sortable .tooltip').css('display', 'none')
$('#sortable .tooltip').css('display', 'none');
$('#sortable').sortable('enable');
setTimeout(function () {
$('.add-item').fadeIn();