From 00042ab594334b699035c68e54d861585b2fcc22 Mon Sep 17 00:00:00 2001 From: "Jokob @NetAlertX" <96159884+jokob-sk@users.noreply.github.com> Date: Wed, 25 Feb 2026 21:59:51 +0000 Subject: [PATCH] refactor: Clean up whitespace and improve API token verification in network initialization --- front/js/network-api.js | 12 ++++++------ front/js/network-init.js | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/front/js/network-api.js b/front/js/network-api.js index 86e93fdb..df6135b9 100644 --- a/front/js/network-api.js +++ b/front/js/network-api.js @@ -7,12 +7,12 @@ */ function getApiToken() { let token = getSetting("API_TOKEN"); - + // If token is not yet available, log warning if (!token || token.trim() === '') { console.warn("API_TOKEN not yet loaded from settings"); } - + return token; } @@ -54,13 +54,13 @@ function loadNetworkNodes() { const apiBase = getApiBase(); const apiToken = getApiToken(); - + // Verify token is available if (!apiToken || apiToken.trim() === '') { console.error("API_TOKEN not available. Settings may not be loaded yet."); return; } - + const url = `${apiBase}/dbquery/read`; $.ajax({ @@ -97,13 +97,13 @@ function loadNetworkNodes() { function loadDeviceTable({ sql, containerSelector, tableId, wrapperHtml = null, assignMode = true }) { const apiBase = getApiBase(); const apiToken = getApiToken(); - + // Verify token is available if (!apiToken || apiToken.trim() === '') { console.error("API_TOKEN not available. Settings may not be loaded yet."); return; } - + const url = `${apiBase}/dbquery/read`; $.ajax({ diff --git a/front/js/network-init.js b/front/js/network-init.js index a5e15d00..bfca39e5 100644 --- a/front/js/network-init.js +++ b/front/js/network-init.js @@ -35,7 +35,7 @@ function initNetworkTopology() { const apiBase = getApiBase(); const apiToken = getApiToken(); - + // Verify token is available before making API call if (!apiToken || apiToken.trim() === '') { console.error("API_TOKEN not available. Settings may not be loaded yet. Retrying in 500ms..."); @@ -45,7 +45,7 @@ function initNetworkTopology() { }, 500); return; } - + const url = `${apiBase}/dbquery/read`; $.ajax({ @@ -143,7 +143,7 @@ function initNetworkTopology() { $(document).ready(function () { // show spinning icon showSpinner(); - + // Start loading the network topology initNetworkTopology(); });