Implementiere unterschiedliche Datenquellen für Entwicklungs- und Produktionsumgebungen
- 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.
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
// components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx
|
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import DateRangePicker from "../DateRangePicker";
|
import DateRangePicker from "../DateRangePicker";
|
||||||
import LoopMeasurementChart from "./LoopMeasurementChart";
|
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { setChartData } from "../../../../../../redux/slices/chartDataSlice";
|
import { setChartData } from "../../../../../../redux/slices/chartDataSlice";
|
||||||
|
|
||||||
@@ -11,8 +9,14 @@ const LoopChartActionBar: React.FC = () => {
|
|||||||
|
|
||||||
const handleFetchData = async () => {
|
const handleFetchData = async () => {
|
||||||
try {
|
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();
|
const data = await response.json();
|
||||||
|
|
||||||
if (Array.isArray(data)) {
|
if (Array.isArray(data)) {
|
||||||
console.log("Daten geladen:", data);
|
console.log("Daten geladen:", data);
|
||||||
dispatch(setChartData(data));
|
dispatch(setChartData(data));
|
||||||
|
|||||||
@@ -6,5 +6,5 @@
|
|||||||
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
const webVersion = "1.6.47";
|
const webVersion = "1.6.48";
|
||||||
export default webVersion;
|
export default webVersion;
|
||||||
|
|||||||
Reference in New Issue
Block a user