refactor: Clean up whitespace and improve API token verification in network initialization

This commit is contained in:
Jokob @NetAlertX
2026-02-25 21:59:51 +00:00
parent 786cc5ee33
commit 00042ab594
2 changed files with 9 additions and 9 deletions

View File

@@ -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({