From 7523775edf79c706b5aeed5592fa34a0463fdb15 Mon Sep 17 00:00:00 2001 From: ISA Date: Fri, 14 Feb 2025 11:52:41 +0100 Subject: [PATCH] =?UTF-8?q?Implementiere=20unterschiedliche=20Datenquellen?= =?UTF-8?q?=20f=C3=BCr=20Entwicklungs-=20und=20Produktionsumgebungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Entwicklung: Daten werden aus der Datei `/mockData.json` geladen. - Produktion: Daten werden von der URL `/CPL?seite.ACP&DIA1=2025;01;01;2025;07;31;2;4` abgerufen. Dies ermöglicht eine realistische Datenverarbeitung in der Produktion, während in der Entwicklungsumgebung weiterhin mit Mock-Daten gearbeitet wird. --- .../Charts/LoopMeasurementChart/LoopChartActionBar.tsx | 10 +++++++--- config/webVersion.ts | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx index ae84da8..ba5ea41 100644 --- a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx +++ b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx @@ -1,7 +1,5 @@ -// components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx import React, { useState } from "react"; import DateRangePicker from "../DateRangePicker"; -import LoopMeasurementChart from "./LoopMeasurementChart"; import { useDispatch } from "react-redux"; import { setChartData } from "../../../../../../redux/slices/chartDataSlice"; @@ -11,8 +9,14 @@ const LoopChartActionBar: React.FC = () => { const handleFetchData = async () => { try { - const response = await fetch("/mockData.json"); + const apiUrl = + process.env.NODE_ENV === "development" + ? "/mockData.json" + : "/CPL?seite.ACP&DIA1=2025;01;01;2025;07;31;2;4"; + + const response = await fetch(apiUrl); const data = await response.json(); + if (Array.isArray(data)) { console.log("Daten geladen:", data); dispatch(setChartData(data)); diff --git a/config/webVersion.ts b/config/webVersion.ts index 418eabe..a65e6df 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.47"; +const webVersion = "1.6.48"; export default webVersion;