Files
nodeMap/config/urls.js

16 lines
469 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// /config/urls.js
// Dynamische Bestimmung der URLs basierend auf window.location.origin ohne Port
let BASE_URL, SERVER_URL;
const basePath = process.env.NEXT_PUBLIC_BASE_PATH;
if (typeof window !== "undefined") {
const url = new URL(window.location.origin);
const originWithoutPort = `${url.protocol}//${url.hostname}`; // z.B. http://10.10.0.13
BASE_URL = `${originWithoutPort}/api`;
SERVER_URL = originWithoutPort;
}
export { BASE_URL, SERVER_URL };