From 82041f391f924f870ee36eda61d72b04ae207256 Mon Sep 17 00:00:00 2001 From: netalertx-fedora <@gitconfigbackup.thehomelab.cc> Date: Fri, 9 Jan 2026 12:37:54 +0100 Subject: [PATCH] Fix Saving Changes in Devices Page. --- front/deviceDetailsEdit.php | 8 +++----- front/deviceDetailsTools.php | 7 ++++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/front/deviceDetailsEdit.php b/front/deviceDetailsEdit.php index c76833e3..cd654b4e 100755 --- a/front/deviceDetailsEdit.php +++ b/front/deviceDetailsEdit.php @@ -354,9 +354,7 @@ function setDeviceData(direction = '', refreshCallback = '') { showSpinner(); const apiToken = getSetting("API_TOKEN"); // dynamic token - const host = window.location.hostname; - const protocol = window.location.protocol; - const port = getSetting("GRAPHQL_PORT"); + const apiBase = getApiBase(); mac = $('#NEWDEV_devMac').val(); @@ -404,7 +402,7 @@ function setDeviceData(direction = '', refreshCallback = '') { $.ajax({ - url: `${protocol}//${host}:${port}/device/${encodeURIComponent(mac)}`, + url: `${apiBase}/device/${encodeURIComponent(mac)}`, type: "POST", headers: { "Authorization": "Bearer " + apiToken, @@ -503,4 +501,4 @@ if (!$('#panDetails:visible').length) { } - \ No newline at end of file + diff --git a/front/deviceDetailsTools.php b/front/deviceDetailsTools.php index 989b76f9..469a645a 100755 --- a/front/deviceDetailsTools.php +++ b/front/deviceDetailsTools.php @@ -221,7 +221,8 @@ $("#scanoutput").empty(); - const baseUrl = `${protocol}//${host}:${port}`; + const baseUrl = getApiBase(); + $.ajax({ method: "POST", @@ -590,7 +591,7 @@ const apiToken = getSetting("API_TOKEN"); // optional token if needed // Build base URL dynamically - const baseUrl = `${protocol}//${host}:${port}`; + const baseUrl = getApiBase(); // Delete device events $.ajax({ @@ -640,7 +641,7 @@ return; } - const baseUrl = `${protocol}//${host}:${port}`; + const baseUrl = getApiBase(); $.ajax({ method: "POST",