Skip to content

Commit 82041f3

Browse files
author
netalertx-fedora
committed
Fix Saving Changes in Devices Page.
1 parent 730e8b8 commit 82041f3

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

front/deviceDetailsEdit.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,7 @@ function setDeviceData(direction = '', refreshCallback = '') {
354354
showSpinner();
355355

356356
const apiToken = getSetting("API_TOKEN"); // dynamic token
357-
const host = window.location.hostname;
358-
const protocol = window.location.protocol;
359-
const port = getSetting("GRAPHQL_PORT");
357+
const apiBase = getApiBase();
360358

361359
mac = $('#NEWDEV_devMac').val();
362360

@@ -404,7 +402,7 @@ function setDeviceData(direction = '', refreshCallback = '') {
404402

405403

406404
$.ajax({
407-
url: `${protocol}//${host}:${port}/device/${encodeURIComponent(mac)}`,
405+
url: `${apiBase}/device/${encodeURIComponent(mac)}`,
408406
type: "POST",
409407
headers: {
410408
"Authorization": "Bearer " + apiToken,
@@ -503,4 +501,4 @@ function deviceDetailsPageUpdater() {
503501
}
504502

505503

506-
</script>
504+
</script>

front/deviceDetailsTools.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ function manualnmapscan(targetip, mode) {
221221
$("#scanoutput").empty();
222222

223223

224-
const baseUrl = `${protocol}//${host}:${port}`;
224+
const baseUrl = getApiBase();
225+
225226

226227
$.ajax({
227228
method: "POST",
@@ -590,7 +591,7 @@ function deleteDeviceEvents () {
590591
const apiToken = getSetting("API_TOKEN"); // optional token if needed
591592

592593
// Build base URL dynamically
593-
const baseUrl = `${protocol}//${host}:${port}`;
594+
const baseUrl = getApiBase();
594595

595596
// Delete device events
596597
$.ajax({
@@ -640,7 +641,7 @@ function resetDeviceProps () {
640641
return;
641642
}
642643

643-
const baseUrl = `${protocol}//${host}:${port}`;
644+
const baseUrl = getApiBase();
644645

645646
$.ajax({
646647
method: "POST",

0 commit comments

Comments
 (0)