Use getApiBase() to get GraphQL Endpoint.

This commit is contained in:
netalertx-fedora
2026-01-09 22:46:56 +01:00
parent 00a1875665
commit 7b15329a02
2 changed files with 7 additions and 12 deletions

View File

@@ -160,11 +160,10 @@ function periodChanged() {
function getEventsTotals() {
stopTimerRefreshData();
const protocol = window.location.protocol.replace(":", "");
const host = window.location.hostname;
const port = getSetting("GRAPHQL_PORT");
// Build API URL
const apiBase = getApiBase();
const apiToken = getSetting("API_TOKEN");
const url = `${protocol}://${host}:${port}/sessions/totals?period=${encodeURIComponent(period)}`;
const url = `${apiBase}/sessions/totals?period=${encodeURIComponent(period)}`;
$.ajax({
url,
@@ -207,11 +206,9 @@ function getEvents(type) {
table.column(7).visible(config.sesionCols);
// Build API URL
const protocol = window.location.protocol.replace(":", "");
const host = window.location.hostname;
const port = getSetting("GRAPHQL_PORT");
const apiBase = getApiBase();
const apiToken = getSetting("API_TOKEN");
const url = `${protocol}://${host}:${port}/sessions/session-events?type=${encodeURIComponent(type)}&period=${encodeURIComponent(period)}`;
const url = `${apiBase}/sessions/session-events?type=${encodeURIComponent(type)}&period=${encodeURIComponent(period)}`;
table.clear().draw(); // Clear old rows