chore: rename service/thunk files to follow get/fetch naming convention

This commit is contained in:
ISA
2025-06-20 14:07:29 +02:00
parent 0388512f51
commit 38ee1ae381
13 changed files with 25 additions and 20 deletions

View File

@@ -6,5 +6,5 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false
NEXT_PUBLIC_EXPORT_STATIC=false
NEXT_PUBLIC_USE_CGI=false
# App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.6.435
NEXT_PUBLIC_APP_VERSION=1.6.436
NEXT_PUBLIC_CPL_MODE=jsmock # json (Entwicklungsumgebung) oder jsmock (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)

View File

@@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL
NEXT_PUBLIC_EXPORT_STATIC=true
NEXT_PUBLIC_USE_CGI=true
# App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.6.435
NEXT_PUBLIC_APP_VERSION=1.6.436
NEXT_PUBLIC_CPL_MODE=production

View File

@@ -1,3 +1,8 @@
## [1.6.436] 2025-06-20
- Mocks erstellt für API für Entwicklungsumgebung
---
## [1.6.435] 2025-06-20
- auto CHANGELOG.md

View File

@@ -17,7 +17,7 @@ import "chartjs-adapter-date-fns";
import { de } from "date-fns/locale";
import { useSelector, useDispatch } from "react-redux";
import type { RootState, AppDispatch } from "../../../redux/store";
import { fetchAnalogInputsHistoryThunk } from "../../../redux/thunks/fetchAnalogInputsHistoryThunk";
import { getAnalogInputsHistoryThunk } from "@/redux/thunks/getAnalogInputsHistoryThunk";
ChartJS.register(
LineElement,
@@ -41,7 +41,7 @@ export default function AnalogInputsChart({
);
useEffect(() => {
dispatch(fetchAnalogInputsHistoryThunk());
dispatch(getAnalogInputsHistoryThunk());
}, [dispatch]);
if (!selectedId) {

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "cpl-v4",
"version": "1.6.435",
"version": "1.6.436",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cpl-v4",
"version": "1.6.435",
"version": "1.6.436",
"dependencies": {
"@fontsource/roboto": "^5.1.0",
"@iconify-icons/ri": "^1.2.10",

View File

@@ -1,6 +1,6 @@
{
"name": "cpl-v4",
"version": "1.6.435",
"version": "1.6.436",
"private": true,
"scripts": {
"dev": "next dev",

View File

@@ -15,7 +15,7 @@ import Footer from "../components/footer/Footer";
import { fetchKueDataThunk } from "../redux/thunks/fetchKueDataThunk";
import { fetchDigitalOutputsThunk } from "../redux/thunks/fetchDigitalOutputsThunk";
import { fetchAnalogInputsThunk } from "../redux/thunks/fetchAnalogInputsThunk";
import { fetchAnalogInputsHistoryThunk } from "../redux/thunks/fetchAnalogInputsHistoryThunk";
import { getAnalogInputsHistoryThunk } from "../redux/thunks/getAnalogInputsHistoryThunk";
import { fetchLast20MessagesThunk } from "../redux/thunks/fetchLast20MessagesThunk";
import { fetchOpcUaSettingsThunk } from "../redux/thunks/fetchOpcUaSettingsThunk";
import { fetchSystemSettingsThunk } from "../redux/thunks/fetchSystemSettingsThunk";
@@ -53,7 +53,7 @@ function AppContent({ Component, pageProps }: AppProps) {
} else if (pathname.includes("analogInputs")) {
dispatch(fetchAnalogInputsThunk());
} else if (pathname.includes("analogHistory")) {
dispatch(fetchAnalogInputsHistoryThunk());
dispatch(getAnalogInputsHistoryThunk());
} else if (pathname.includes("dashboard")) {
dispatch(fetchLast20MessagesThunk());
} else if (pathname.includes("einstellungen")) {

View File

@@ -1,4 +1,4 @@
// /pages/api/cpl/fetchAnalogInputsHistory.ts
// /pages/api/cpl/getAnalogInputsHistory.ts
import path from "path";
import fs from "fs/promises";

View File

@@ -1,6 +1,6 @@
// /redux/slices/analogInputsHistorySlice.ts
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { fetchAnalogInputsHistoryThunk } from "../thunks/fetchAnalogInputsHistoryThunk";
import { getAnalogInputsHistoryThunk } from "../thunks/getAnalogInputsHistoryThunk";
type InputHistoryState = {
data: Record<number, any[]>;
@@ -20,18 +20,18 @@ const analogInputsHistorySlice = createSlice({
reducers: {},
extraReducers: (builder) => {
builder
.addCase(fetchAnalogInputsHistoryThunk.pending, (state) => {
.addCase(getAnalogInputsHistoryThunk.pending, (state) => {
state.isLoading = true;
state.error = null;
})
.addCase(
fetchAnalogInputsHistoryThunk.fulfilled,
getAnalogInputsHistoryThunk.fulfilled,
(state, action: PayloadAction<Record<number, any[]>>) => {
state.data = action.payload;
state.isLoading = false;
}
)
.addCase(fetchAnalogInputsHistoryThunk.rejected, (state, action) => {
.addCase(getAnalogInputsHistoryThunk.rejected, (state, action) => {
state.isLoading = false;
state.error = action.payload as string;
});

View File

@@ -1,6 +1,6 @@
// /redux/slices/tdmChartSlice.ts
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { fetchAllTDMData } from "../thunks/fetchAllTDMThunk";
import { fetchAllTDMData } from "../thunks/getAllTDMThunk";
import type { TDMEntry } from "../types/tdmEntryTypes";
interface TDMChartState {

View File

@@ -1,4 +1,4 @@
// /redux/thunks/fetchAllTDMThunk.ts
// /redux/thunks/getAllTDMThunk.ts
import { createAsyncThunk } from "@reduxjs/toolkit";
import { RootState } from "../store";

View File

@@ -1,8 +1,8 @@
// /redux/thunks/fetchAnalogInputsHistoryThunk.ts
// /redux/thunks/getAnalogInputsHistoryThunk.ts
import { createAsyncThunk } from "@reduxjs/toolkit";
import { fetchAnalogInputsHistoryService } from "../../services/fetchAnalogInputsHistoryService";
import { fetchAnalogInputsHistoryService } from "@/services/fetchAnalogInputsHistoryService";
export const fetchAnalogInputsHistoryThunk = createAsyncThunk(
export const getAnalogInputsHistoryThunk = createAsyncThunk(
"analogInputsHistory/fetch",
async (_, { rejectWithValue }) => {
try {

View File

@@ -22,7 +22,7 @@ export async function fetchAnalogInputsHistoryService(): Promise<
if (isDev) {
// ⬇️ ENTWICKLUNG: über API-Handler
const response = await fetch("/api/cpl/fetchAnalogInputsHistory");
const response = await fetch("/api/cpl/getAnalogInputsHistory");
if (!response.ok) throw new Error("Fehler beim Laden der Mock-Daten");
return await response.json();
}