Mock daten für DIA0, DIA1 und DIA2 für KÜs-Charts

This commit is contained in:
ISA
2025-02-20 13:57:15 +01:00
parent ac9b94eb5f
commit 2ad1f943ce
11 changed files with 129 additions and 19 deletions

View File

@@ -30,18 +30,20 @@ const LoopChartActionBar: React.FC = () => {
* @param mode - DIA0, DIA1 oder DIA2
* @param slotIndex - Slot für die Abfrage
*/
const getApiUrl = (mode: "DIA0" | "DIA1" | "DIA2") => {
const getApiUrl = (mode: "DIA0" | "DIA1" | "DIA2", type: number) => {
return process.env.NODE_ENV === "development"
? `/CPLmockData/kuesChartData/${mode}.json`
: `/CPL?seite.ACP&${mode}=${vonDatum};${bisDatum};${slotIndex}`;
? `/CPLmockData/kuesChartData/${mode}_${type}.json`
: `/CPL?seite.ACP&${mode}=${vonDatum};${bisDatum};${type}`;
};
/**
* Funktion zum Laden der Messwerte
*/
const handleFetchData = async () => {
const type = selectedSlotType === "schleifenwiderstand" ? 4 : 3; // 4 für Schleifenwiderstand, 3 für Isolationswiderstand
try {
const apiUrl = getApiUrl(selectedMode);
const apiUrl = getApiUrl(selectedMode, type);
console.log("Mock JSON laden von:", apiUrl);
const response = await fetch(apiUrl);