chore: fetch to get in redux thunks files name

This commit is contained in:
Ismail Ali
2025-06-21 10:15:05 +02:00
parent dd76665848
commit 7740806952
42 changed files with 144 additions and 126 deletions

View File

@@ -3,29 +3,29 @@
import { useEffect, useState } from "react";
import { Provider } from "react-redux";
import store, { useAppDispatch } from "../redux/store";
import store, { useAppDispatch } from "@/redux/store";
import { AppProps } from "next/app";
import { loadWindowVariables } from "../utils/loadWindowVariables";
import { loadWindowVariables } from "@/utils/loadWindowVariables";
import Header from "../components/header/Header";
import Navigation from "../components/navigation/Navigation";
import Footer from "../components/footer/Footer";
import Header from "@/components/header/Header";
import Navigation from "@/components/navigation/Navigation";
import Footer from "@/components/footer/Footer";
// Thunks importieren
import { fetchKueDataThunk } from "../redux/thunks/fetchKueDataThunk";
import { fetchDigitalOutputsThunk } from "../redux/thunks/fetchDigitalOutputsThunk";
import { fetchAnalogInputsThunk } from "../redux/thunks/fetchAnalogInputsThunk";
import { getAnalogInputsHistoryThunk } from "../redux/thunks/getAnalogInputsHistoryThunk";
import { fetchLast20MessagesThunk } from "../redux/thunks/fetchLast20MessagesThunk";
import { fetchOpcUaSettingsThunk } from "../redux/thunks/fetchOpcUaSettingsThunk";
import { fetchSystemSettingsThunk } from "../redux/thunks/fetchSystemSettingsThunk";
import { fetchSystemVoltTempThunk } from "../redux/thunks/fetchSystemVoltTempThunk";
import { fetchReferenceCurveBySlotThunk } from "../redux/thunks/fetchReferenceCurveBySlotThunk";
import { getKueDataThunk } from "@/redux/thunks/getKueDataThunk";
import { getDigitalOutputsThunk } from "@/redux/thunks/getDigitalOutputsThunk";
import { getAnalogInputsThunk } from "@/redux/thunks/getAnalogInputsThunk";
import { getAnalogInputsHistoryThunk } from "@/redux/thunks/getAnalogInputsHistoryThunk";
import { getLast20MessagesThunk } from "@/redux/thunks/getLast20MessagesThunk";
import { getOpcUaSettingsThunk } from "@/redux/thunks/getOpcUaSettingsThunk";
import { getSystemSettingsThunk } from "@/redux/thunks/getSystemSettingsThunk";
import { getSystemVoltTempThunk } from "@/redux/thunks/getSystemVoltTempThunk";
import { getReferenceCurveBySlotThunk } from "@/redux/thunks/getReferenceCurveBySlotThunk";
import { getAllTDRReferenceChartThunk } from "@/redux/thunks/getAllTDRReferenceChartThunk";
import { fetchTDRChartDataByIdThunk } from "../redux/thunks/fetchTDRChartDataByIdThunk";
import { fetchLoopChartDataThunk } from "../redux/thunks/fetchLoopChartDataThunk";
import { getTDRChartDataByIdThunk } from "@/redux/thunks/getTDRChartDataByIdThunk";
import { getLoopChartDataThunk } from "@/redux/thunks/getLoopChartDataThunk";
import "../styles/globals.css";
import "@/styles/globals.css";
function MyApp({ Component, pageProps }: AppProps) {
return (
@@ -35,7 +35,13 @@ function MyApp({ Component, pageProps }: AppProps) {
);
}
function AppContent({ Component, pageProps }: AppProps) {
function AppContent({
Component,
pageProps,
}: {
Component: AppProps["Component"];
pageProps: AppProps["pageProps"];
}): JSX.Element {
const dispatch = useAppDispatch();
const [sessionExpired, setSessionExpired] = useState(false);
@@ -45,31 +51,31 @@ function AppContent({ Component, pageProps }: AppProps) {
const loadAndDispatch = () => {
if (pathname.includes("kabelueberwachung")) {
dispatch(fetchKueDataThunk());
dispatch(getKueDataThunk());
} else if (pathname.includes("digitalOutputs")) {
dispatch(fetchDigitalOutputsThunk());
dispatch(getDigitalOutputsThunk());
} else if (pathname.includes("digitalInputs")) {
dispatch(fetchDigitalOutputsThunk()); // 🟠 evtl. anpassen
dispatch(getDigitalOutputsThunk()); // 🟠 evtl. anpassen
} else if (pathname.includes("analogInputs")) {
dispatch(fetchAnalogInputsThunk());
dispatch(getAnalogInputsThunk());
} else if (pathname.includes("analogHistory")) {
dispatch(getAnalogInputsHistoryThunk());
} else if (pathname.includes("dashboard")) {
dispatch(fetchLast20MessagesThunk());
dispatch(getLast20MessagesThunk());
} else if (pathname.includes("einstellungen")) {
dispatch(fetchOpcUaSettingsThunk());
dispatch(getOpcUaSettingsThunk());
} else if (pathname.includes("systemvolt")) {
dispatch(fetchSystemVoltTempThunk());
dispatch(getSystemVoltTempThunk());
} else if (pathname.includes("system")) {
dispatch(fetchSystemSettingsThunk());
dispatch(getSystemSettingsThunk());
} else if (pathname.includes("tdrRef")) {
dispatch(getAllTDRReferenceChartThunk());
} else if (pathname.includes("tdrSlot")) {
dispatch(fetchReferenceCurveBySlotThunk());
dispatch(getReferenceCurveBySlotThunk());
} else if (pathname.includes("tdrId")) {
dispatch(fetchTDRChartDataByIdThunk());
dispatch(getTDRChartDataByIdThunk());
} else if (pathname.includes("loopChart")) {
dispatch(fetchLoopChartDataThunk());
dispatch(getLoopChartDataThunk());
}
};