diff --git a/src/usr/local/emhttp/plugins/netbird/include/status_view.php b/src/usr/local/emhttp/plugins/netbird/include/status_view.php index d97a7c9..a4f837e 100644 --- a/src/usr/local/emhttp/plugins/netbird/include/status_view.php +++ b/src/usr/local/emhttp/plugins/netbird/include/status_view.php @@ -300,10 +300,15 @@ function nbAction(action) { : ($('input[name=csrf_token]').val()) ? 'dom-input' : 'none'); $.post('/plugins/netbird/include/action.php', { action: action, csrf_token: token }, function(data) { + var isError = data && (data.type === 'error' || data.type === 'warning'); if (data && data.message) { swal({ title: data.title || 'NetBird', text: data.message, type: data.type || 'info' }); } - setTimeout(function(){ location.reload(); }, 1500); + // Only refresh on success; on an error/warning leave the message up so the + // user can read it and dismiss it themselves (nothing changed to refresh). + if (!isError) { + setTimeout(function(){ location.reload(); }, 1500); + } }, 'json').fail(function(xhr){ swal({ title: 'NetBird error', text: xhr.responseText || 'Request failed', type: 'error' }); });