feat: Umgebungsspezifisches Laden von Datenquellen implementiert
- Alle fetch-Services (TDM, TDR, analoge/digitale Eingänge/Ausgänge, SystemSettings usw.) angepasst, um `NEXT_PUBLIC_NODE_ENV` zu verwenden. - Entwicklungsumgebung lädt Daten aus /CPLmockData/... - Produktionsumgebung verwendet echte Endpunkte mit /CPL?/CPL/... - .env.production und .env.development korrekt berücksichtigt - loadWindowVariables, WindowVariablesInitializer und verwandte Dateien bereinigt - Mockdaten erscheinen nicht mehr versehentlich in Produktionsumgebung
This commit is contained in:
@@ -3,12 +3,12 @@
|
||||
export const fetchAllTDMDataFromServer = async (): Promise<any[]> => {
|
||||
if (typeof window === "undefined") return [];
|
||||
|
||||
const isDev = window.location.hostname === "localhost";
|
||||
const isDev = process.env.NEXT_PUBLIC_NODE_ENV === "development";
|
||||
|
||||
const slotRequests = Array.from({ length: 32 }, (_, i) => {
|
||||
const url = isDev
|
||||
? `/CPLmockData/TDM/slot${i}.json` // ✅ korrekt für DEV (Dateien im public-Ordner)
|
||||
: `${window.location.origin}/CPL?Service/empty.acp&TDM=${i}`; // ✅ korrekt für PROD
|
||||
? `/CPLmockData/TDM/slot${i}.json` // ✅ Entwicklung: aus public-Ordner
|
||||
: `${window.location.origin}/CPL?Service/empty.acp&TDM=${i}`; // ✅ Produktion
|
||||
|
||||
return fetch(url)
|
||||
.then((res) => (res.ok ? res.json() : null))
|
||||
|
||||
Reference in New Issue
Block a user