refactor: Naming-Konventionen für digitaleEingaenge umgesetzt

- digitaleEingaengeMockData.js = strukturierte Datenbasis für Development
- digitaleEingaengeAPIHandler.ts = API-Endpunkt zur Auslieferung im Dev
- fetchDigitaleEingaengeService.ts = Service zur Umwandlung von window-Variablen
- Naming-Schema sorgt für klare Struktur und gute Lernbarkeit
This commit is contained in:
Ismail Ali
2025-04-15 08:55:50 +02:00
parent fb87e7b3ae
commit f709c2e3b7
22 changed files with 22 additions and 22 deletions

View File

@@ -0,0 +1,33 @@
// /services/fetchAllTDRReferenceChartDataService.ts
const getTDRReferenceBasePath = () => {
if (typeof window !== "undefined") {
const env = process.env.NEXT_PUBLIC_NODE_ENV;
return env === "development"
? "/apiMockData/tdr-reference-curves"
: "/CPL?/CPL/tdr-reference-curves";
}
return "";
};
export const fetchAllTDRReferenceChartData = async () => {
const maxSlots = 32;
const results = [];
const basePath = getTDRReferenceBasePath();
for (let i = 0; i < maxSlots; i++) {
try {
const response = await fetch(`${basePath}/slot${i}.json`);
if (!response.ok) {
results[i] = null;
continue;
}
const json = await response.json();
results[i] = json;
} catch (error) {
results[i] = null;
}
}
return results;
};