feat: API-Route für gefilterte Mock-Daten implementiert

- Neue Route /api/cpl/slotData erstellt
- Lädt Daten aus /public/CPLmockData/kuesChartData/... basierend auf slot, messart und dia
- Optionales Filtern über vonDatum und bisDatum hinzugefügt
- 404-Fehler bei fehlender Datei wird abgefangen
This commit is contained in:
Ismail Ali
2025-04-08 18:35:34 +02:00
parent 8e48800d81
commit 921c64178c
5 changed files with 73 additions and 3 deletions

View File

@@ -23,7 +23,8 @@ const getApiUrl = (
: "unbekannterTyp";
return process.env.NEXT_PUBLIC_NODE_ENV === "development"
? `/CPLmockData/kuesChartData/slot${slotNumber}/${typeFolder}/${mode}.json`
? // ? `/CPLmockData/kuesChartData/slot${slotNumber}/${typeFolder}/${mode}.json`
`/api/cpl/slotData?slot=${slotNumber}&messart=${typeFolder}&dia=${mode}&vonDatum=${vonDatum}&bisDatum=${bisDatum}`
: `${window.location.origin}/CPL?seite.ACP&${mode}=${formatDate(
vonDatum
)};${formatDate(bisDatum)};${slotNumber};${type};`;