From d4b8381ee7d01713f3c8a089a32757614cf306a4 Mon Sep 17 00:00:00 2001 From: TechHutTV Date: Fri, 22 May 2026 13:44:38 -0700 Subject: [PATCH] Fix auto-refresh on errors --- .../local/emhttp/plugins/netbird/include/status_view.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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' }); });