mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-05 01:31:49 -07:00
Merge pull request #1395 from luckylinux/fix-devices-edit
Fix Saving Changes in Devices Page. - thanks @luckylinux
This commit is contained in:
@@ -354,9 +354,7 @@ function setDeviceData(direction = '', refreshCallback = '') {
|
|||||||
showSpinner();
|
showSpinner();
|
||||||
|
|
||||||
const apiToken = getSetting("API_TOKEN"); // dynamic token
|
const apiToken = getSetting("API_TOKEN"); // dynamic token
|
||||||
const host = window.location.hostname;
|
const apiBase = getApiBase();
|
||||||
const protocol = window.location.protocol;
|
|
||||||
const port = getSetting("GRAPHQL_PORT");
|
|
||||||
|
|
||||||
mac = $('#NEWDEV_devMac').val();
|
mac = $('#NEWDEV_devMac').val();
|
||||||
|
|
||||||
@@ -404,7 +402,7 @@ function setDeviceData(direction = '', refreshCallback = '') {
|
|||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: `${protocol}//${host}:${port}/device/${encodeURIComponent(mac)}`,
|
url: `${apiBase}/device/${encodeURIComponent(mac)}`,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": "Bearer " + apiToken,
|
"Authorization": "Bearer " + apiToken,
|
||||||
|
|||||||
@@ -221,7 +221,8 @@
|
|||||||
$("#scanoutput").empty();
|
$("#scanoutput").empty();
|
||||||
|
|
||||||
|
|
||||||
const baseUrl = `${protocol}//${host}:${port}`;
|
const baseUrl = getApiBase();
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -590,7 +591,7 @@
|
|||||||
const apiToken = getSetting("API_TOKEN"); // optional token if needed
|
const apiToken = getSetting("API_TOKEN"); // optional token if needed
|
||||||
|
|
||||||
// Build base URL dynamically
|
// Build base URL dynamically
|
||||||
const baseUrl = `${protocol}//${host}:${port}`;
|
const baseUrl = getApiBase();
|
||||||
|
|
||||||
// Delete device events
|
// Delete device events
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -640,7 +641,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseUrl = `${protocol}//${host}:${port}`;
|
const baseUrl = getApiBase();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|||||||
Reference in New Issue
Block a user