mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-01-20 04:38:24 -05:00
16 lines
410 B
JavaScript
16 lines
410 B
JavaScript
function getApiBase()
|
|
{
|
|
let apiBase = getSetting("BACKEND_API_URL");
|
|
|
|
if(apiBase == "")
|
|
{
|
|
const protocol = window.location.protocol.replace(':', '');
|
|
const host = window.location.hostname;
|
|
const port = getSetting("GRAPHQL_PORT");
|
|
|
|
apiBase = `${protocol}://${host}:${port}`;
|
|
}
|
|
|
|
// Remove trailing slash for consistency
|
|
return apiBase.replace(/\/$/, '');
|
|
} |