diff --git a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx index 17e3325..00af967 100644 --- a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx +++ b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx @@ -23,26 +23,35 @@ const LoopChartActionBar: React.FC = () => { * API-URL-Erstellung für Entwicklung und Produktion */ const getApiUrl = (mode: "DIA0" | "DIA1" | "DIA2", type: number) => { - return process.env.NODE_ENV === "development" - ? `/CPLmockData/kuesChartData/${mode}_${type}.json` - : `/CPL?seite.ACP&${mode}=${vonDatum};${bisDatum};${type}`; + const baseUrl = + process.env.NODE_ENV === "development" + ? `/CPLmockData/kuesChartData/${mode}_${type}.json` + : `/CPL?seite.ACP&${mode}=${vonDatum};${bisDatum};${selectedSlotType};${type};`; + + return baseUrl; }; + /** + * Funktion zum Laden der Messwerte + */ /** * Funktion zum Laden der Messwerte */ const handleFetchData = async () => { const type = selectedSlotType === "schleifenwiderstand" ? 4 : 3; + const apiUrl = getApiUrl(selectedMode, type); try { - const apiUrl = getApiUrl(selectedMode, type); - console.log("Mock JSON laden von:", apiUrl); + console.log("📡 API-Request an:", apiUrl); // Debugging + const response = await fetch(apiUrl, { + method: "GET", + headers: { "Content-Type": "application/json" }, + }); - const response = await fetch(apiUrl); if (!response.ok) throw new Error(`Fehler: ${response.status}`); const jsonData = await response.json(); - console.log("Geladene Daten:", jsonData); + console.log("✅ Daten erfolgreich geladen:", jsonData); if (Array.isArray(jsonData)) { dispatch(setChartData(jsonData)); @@ -53,12 +62,13 @@ const LoopChartActionBar: React.FC = () => { const lastDate = new Date(jsonData[0].t); dispatch(setVonDatum(firstDate.toISOString().split("T")[0])); dispatch(setBisDatum(lastDate.toISOString().split("T")[0])); + dispatch(setChartOpen(true)); // Chart öffnen } } else { - console.error("Erwartetes Array, aber erhalten:", jsonData); + console.error("⚠️ Erwartetes Array, aber erhalten:", jsonData); } } catch (error) { - console.error("Fehler beim Laden der Mock-Daten:", error); + console.error("❌ Fehler beim Laden der Produktions-Daten:", error); } }; diff --git a/config/webVersion.ts b/config/webVersion.ts index f76f56c..302d254 100644 --- a/config/webVersion.ts +++ b/config/webVersion.ts @@ -6,5 +6,5 @@ 2: Patch oder Hotfix (Bugfixes oder kleine Änderungen). */ -const webVersion = "1.6.83"; +const webVersion = "1.6.84"; export default webVersion;