16 lines
469 B
JavaScript
16 lines
469 B
JavaScript
// /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 };
|