Files
CPLv4.0/redux/thunks/fetchAllTDMThunk.ts
Ismail Ali f709c2e3b7 refactor: Naming-Konventionen für digitaleEingaenge umgesetzt
- digitaleEingaengeMockData.js = strukturierte Datenbasis für Development
- digitaleEingaengeAPIHandler.ts = API-Endpunkt zur Auslieferung im Dev
- fetchDigitaleEingaengeService.ts = Service zur Umwandlung von window-Variablen
- Naming-Schema sorgt für klare Struktur und gute Lernbarkeit
2025-04-15 08:55:50 +02:00

24 lines
747 B
TypeScript

// /redux/thunks/fetchAllTDMThunk.ts
import { createAsyncThunk } from "@reduxjs/toolkit";
import { RootState } from "../store";
import { fetchAllTDMDataFromServer } from "../../services/fetchAllTDMDataService";
export const fetchAllTDMData = createAsyncThunk(
"tdmChart/fetchAllTDMData",
async (_, { getState, rejectWithValue }) => {
const currentData = (getState() as RootState).tdmChartSlice.data;
const newData = await fetchAllTDMDataFromServer();
if (newData.every((entry) => !entry)) {
return rejectWithValue("Keine TDM-Daten empfangen.");
}
if (JSON.stringify(currentData) !== JSON.stringify(newData)) {
return newData;
}
return rejectWithValue("Keine Änderungen in den TDM-Daten.");
}
);