Files
nodeMap/config/config.js
ISA ef3c511694 feat: lade Linienstatusdaten vollständig aus Redux Store
- Entferne direkte Verwendung von `webserviceGisLinesStatusUrl` aus config.js
- Nutze `useLineData()` mit Redux-Toolkit Store
- Baue URL intern in fetchGisLinesStatusService.js dynamisch auf
- Optimiere Tooltip-Generierung aus Webservice-Daten
2025-05-22 14:27:52 +02:00

44 lines
1.5 KiB
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.

// Datei: /config/config.js
import { BASE_URL } from "../config/paths";
// Prüfen, ob Mock-Modus aktiv ist
function isMockMode() {
return process.env.NEXT_PUBLIC_USE_MOCK_API === "true";
}
// Definieren der grundlegenden Umgebungseinstellungen und Konfigurationen der Karte
const mode = process.env.NEXT_PUBLIC_API_PORT_MODE;
let serverURL = "";
if (typeof window !== "undefined") {
serverURL = mode === "dev" ? `${window.location.protocol}//${window.location.hostname}:80` : `${window.location.origin}`;
}
if (typeof window !== "undefined" && !serverURL && !isMockMode()) {
throw new Error("Die Umgebungsvariable ist nicht gesetzt!");
}
if (typeof window !== "undefined") {
console.log("%c 1- serverURL in config:", "color: #006400;", serverURL);
}
// Initialisieren von Variablen, die später im Browserkontext gesetzt werden
let windowHeight, url_string, url, idMap, idUser;
// URL-Setup - dynamisch abhängig von Mock oder Echtbetrieb
if (typeof window !== "undefined") {
windowHeight = window.innerHeight;
url_string = window.location.href;
url = new URL(url_string);
console.log("%c 2- URL in config:", "color: #006400; font-size: 16px; background-color: #f0f0f0;", url);
idMap = url.searchParams.get("m");
idUser = url.searchParams.get("u");
console.log(`4- Parameter 'idMap' : ${idMap}`);
console.log(`5- Parameter 'idUser': ${idUser}`);
}
// Export der Variablen und URLs
export { serverURL, windowHeight, url_string, url, idMap, idUser, isMockMode };