feat: APIs erstellt für Systemspannungen
This commit is contained in:
50
redux/slices/systemspannung15VminusSlice.ts
Normal file
50
redux/slices/systemspannung15VminusSlice.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { getSystemspannung15VminusThunk } from "../thunks/getSystemspannung15VminusThunk";
|
||||
|
||||
type StateType = {
|
||||
DIA0: unknown[];
|
||||
DIA1: unknown[];
|
||||
DIA2: unknown[];
|
||||
isLoading: boolean;
|
||||
error: string | null;
|
||||
};
|
||||
|
||||
const initialState: StateType = {
|
||||
DIA0: [],
|
||||
DIA1: [],
|
||||
DIA2: [],
|
||||
isLoading: false,
|
||||
error: null,
|
||||
};
|
||||
|
||||
export const systemspannung15VminusSlice = createSlice({
|
||||
name: "systemspannung15Vminus",
|
||||
initialState,
|
||||
reducers: {},
|
||||
extraReducers: (builder) => {
|
||||
builder
|
||||
.addCase(getSystemspannung15VminusThunk.pending, (state) => {
|
||||
state.isLoading = true;
|
||||
state.error = null;
|
||||
})
|
||||
.addCase(
|
||||
getSystemspannung15VminusThunk.fulfilled,
|
||||
(
|
||||
state,
|
||||
action: PayloadAction<{
|
||||
typ: "DIA0" | "DIA1" | "DIA2";
|
||||
data: unknown[];
|
||||
}>
|
||||
) => {
|
||||
state.isLoading = false;
|
||||
state[action.payload.typ] = action.payload.data;
|
||||
}
|
||||
)
|
||||
.addCase(getSystemspannung15VminusThunk.rejected, (state, action) => {
|
||||
state.isLoading = false;
|
||||
state.error = action.payload as string;
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export default systemspannung15VminusSlice.reducer;
|
||||
50
redux/slices/systemspannung15VplusSlice.ts
Normal file
50
redux/slices/systemspannung15VplusSlice.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { getSystemspannung15VplusThunk } from "../thunks/getSystemspannung15VplusThunk";
|
||||
|
||||
type StateType = {
|
||||
DIA0: unknown[];
|
||||
DIA1: unknown[];
|
||||
DIA2: unknown[];
|
||||
isLoading: boolean;
|
||||
error: string | null;
|
||||
};
|
||||
|
||||
const initialState: StateType = {
|
||||
DIA0: [],
|
||||
DIA1: [],
|
||||
DIA2: [],
|
||||
isLoading: false,
|
||||
error: null,
|
||||
};
|
||||
|
||||
export const systemspannung15VplusSlice = createSlice({
|
||||
name: "systemspannung15Vplus",
|
||||
initialState,
|
||||
reducers: {},
|
||||
extraReducers: (builder) => {
|
||||
builder
|
||||
.addCase(getSystemspannung15VplusThunk.pending, (state) => {
|
||||
state.isLoading = true;
|
||||
state.error = null;
|
||||
})
|
||||
.addCase(
|
||||
getSystemspannung15VplusThunk.fulfilled,
|
||||
(
|
||||
state,
|
||||
action: PayloadAction<{
|
||||
typ: "DIA0" | "DIA1" | "DIA2";
|
||||
data: unknown[];
|
||||
}>
|
||||
) => {
|
||||
state.isLoading = false;
|
||||
state[action.payload.typ] = action.payload.data;
|
||||
}
|
||||
)
|
||||
.addCase(getSystemspannung15VplusThunk.rejected, (state, action) => {
|
||||
state.isLoading = false;
|
||||
state.error = action.payload as string;
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export default systemspannung15VplusSlice.reducer;
|
||||
50
redux/slices/systemspannung98VminusSlice.ts
Normal file
50
redux/slices/systemspannung98VminusSlice.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { getSystemspannung98VminusThunk } from "../thunks/getSystemspannung98VminusThunk";
|
||||
|
||||
type StateType = {
|
||||
DIA0: unknown[];
|
||||
DIA1: unknown[];
|
||||
DIA2: unknown[];
|
||||
isLoading: boolean;
|
||||
error: string | null;
|
||||
};
|
||||
|
||||
const initialState: StateType = {
|
||||
DIA0: [],
|
||||
DIA1: [],
|
||||
DIA2: [],
|
||||
isLoading: false,
|
||||
error: null,
|
||||
};
|
||||
|
||||
export const systemspannung98VminusSlice = createSlice({
|
||||
name: "systemspannung98Vminus",
|
||||
initialState,
|
||||
reducers: {},
|
||||
extraReducers: (builder) => {
|
||||
builder
|
||||
.addCase(getSystemspannung98VminusThunk.pending, (state) => {
|
||||
state.isLoading = true;
|
||||
state.error = null;
|
||||
})
|
||||
.addCase(
|
||||
getSystemspannung98VminusThunk.fulfilled,
|
||||
(
|
||||
state,
|
||||
action: PayloadAction<{
|
||||
typ: "DIA0" | "DIA1" | "DIA2";
|
||||
data: unknown[];
|
||||
}>
|
||||
) => {
|
||||
state.isLoading = false;
|
||||
state[action.payload.typ] = action.payload.data;
|
||||
}
|
||||
)
|
||||
.addCase(getSystemspannung98VminusThunk.rejected, (state, action) => {
|
||||
state.isLoading = false;
|
||||
state.error = action.payload as string;
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export default systemspannung98VminusSlice.reducer;
|
||||
50
redux/slices/temperaturAdWandlerSlice.ts
Normal file
50
redux/slices/temperaturAdWandlerSlice.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { getTemperaturAdWandlerThunk } from "../thunks/getTemperaturAdWandlerThunk";
|
||||
|
||||
type StateType = {
|
||||
DIA0: unknown[];
|
||||
DIA1: unknown[];
|
||||
DIA2: unknown[];
|
||||
isLoading: boolean;
|
||||
error: string | null;
|
||||
};
|
||||
|
||||
const initialState: StateType = {
|
||||
DIA0: [],
|
||||
DIA1: [],
|
||||
DIA2: [],
|
||||
isLoading: false,
|
||||
error: null,
|
||||
};
|
||||
|
||||
export const temperaturAdWandlerSlice = createSlice({
|
||||
name: "temperaturAdWandler",
|
||||
initialState,
|
||||
reducers: {},
|
||||
extraReducers: (builder) => {
|
||||
builder
|
||||
.addCase(getTemperaturAdWandlerThunk.pending, (state) => {
|
||||
state.isLoading = true;
|
||||
state.error = null;
|
||||
})
|
||||
.addCase(
|
||||
getTemperaturAdWandlerThunk.fulfilled,
|
||||
(
|
||||
state,
|
||||
action: PayloadAction<{
|
||||
typ: "DIA0" | "DIA1" | "DIA2";
|
||||
data: unknown[];
|
||||
}>
|
||||
) => {
|
||||
state.isLoading = false;
|
||||
state[action.payload.typ] = action.payload.data;
|
||||
}
|
||||
)
|
||||
.addCase(getTemperaturAdWandlerThunk.rejected, (state, action) => {
|
||||
state.isLoading = false;
|
||||
state.error = action.payload as string;
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export default temperaturAdWandlerSlice.reducer;
|
||||
50
redux/slices/temperaturProzessorSlice.ts
Normal file
50
redux/slices/temperaturProzessorSlice.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import { getTemperaturProzessorThunk } from "../thunks/getTemperaturProzessorThunk";
|
||||
|
||||
type StateType = {
|
||||
DIA0: unknown[];
|
||||
DIA1: unknown[];
|
||||
DIA2: unknown[];
|
||||
isLoading: boolean;
|
||||
error: string | null;
|
||||
};
|
||||
|
||||
const initialState: StateType = {
|
||||
DIA0: [],
|
||||
DIA1: [],
|
||||
DIA2: [],
|
||||
isLoading: false,
|
||||
error: null,
|
||||
};
|
||||
|
||||
export const temperaturProzessorSlice = createSlice({
|
||||
name: "temperaturProzessor",
|
||||
initialState,
|
||||
reducers: {},
|
||||
extraReducers: (builder) => {
|
||||
builder
|
||||
.addCase(getTemperaturProzessorThunk.pending, (state) => {
|
||||
state.isLoading = true;
|
||||
state.error = null;
|
||||
})
|
||||
.addCase(
|
||||
getTemperaturProzessorThunk.fulfilled,
|
||||
(
|
||||
state,
|
||||
action: PayloadAction<{
|
||||
typ: "DIA0" | "DIA1" | "DIA2";
|
||||
data: unknown[];
|
||||
}>
|
||||
) => {
|
||||
state.isLoading = false;
|
||||
state[action.payload.typ] = action.payload.data;
|
||||
}
|
||||
)
|
||||
.addCase(getTemperaturProzessorThunk.rejected, (state, action) => {
|
||||
state.isLoading = false;
|
||||
state.error = action.payload as string;
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export default temperaturProzessorSlice.reducer;
|
||||
@@ -30,6 +30,11 @@ import firmwareUpdateReducer from "@/redux/slices/firmwareUpdateSlice";
|
||||
import confirmModalReducer from "./slices/confirmModalSlice";
|
||||
import firmwareProgressReducer from "./slices/firmwareProgressSlice";
|
||||
import systemspannung5VplusReducer from "./slices/systemspannung5VplusSlice";
|
||||
import systemspannung15VminusReducer from "./slices/systemspannung15VminusSlice";
|
||||
import systemspannung15VplusReducer from "./slices/systemspannung15VplusSlice";
|
||||
import systemspannung98VminusReducer from "./slices/systemspannung98VminusSlice";
|
||||
import temperaturAdWandlerReducer from "./slices/temperaturAdWandlerSlice";
|
||||
import temperaturProzessorReducer from "./slices/temperaturProzessorSlice";
|
||||
|
||||
const store = configureStore({
|
||||
reducer: {
|
||||
@@ -62,6 +67,11 @@ const store = configureStore({
|
||||
confirmModal: confirmModalReducer,
|
||||
firmwareProgress: firmwareProgressReducer,
|
||||
systemspannung5Vplus: systemspannung5VplusReducer,
|
||||
systemspannung15Vminus: systemspannung15VminusReducer,
|
||||
systemspannung15Vplus: systemspannung15VplusReducer,
|
||||
systemspannung98Vminus: systemspannung98VminusReducer,
|
||||
temperaturAdWandler: temperaturAdWandlerReducer,
|
||||
temperaturProzessor: temperaturProzessorReducer,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
15
redux/thunks/getSystemspannung15VminusThunk.ts
Normal file
15
redux/thunks/getSystemspannung15VminusThunk.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import { fetchSystemspannung15VminusService } from "@/services/fetchSystemspannung15VminusService";
|
||||
|
||||
export const getSystemspannung15VminusThunk = createAsyncThunk(
|
||||
"systemspannung15Vminus/fetch",
|
||||
async (typ: "DIA0" | "DIA1" | "DIA2", thunkAPI) => {
|
||||
try {
|
||||
const data = await fetchSystemspannung15VminusService(typ);
|
||||
return { typ, data };
|
||||
} catch (error) {
|
||||
console.error("Fehler in getSystemspannung15VminusThunk:", error);
|
||||
return thunkAPI.rejectWithValue("Fehler beim Laden der -15V-Daten");
|
||||
}
|
||||
}
|
||||
);
|
||||
15
redux/thunks/getSystemspannung15VplusThunk.ts
Normal file
15
redux/thunks/getSystemspannung15VplusThunk.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import { fetchSystemspannung15VplusService } from "@/services/fetchSystemspannung15VplusService";
|
||||
|
||||
export const getSystemspannung15VplusThunk = createAsyncThunk(
|
||||
"systemspannung15Vplus/fetch",
|
||||
async (typ: "DIA0" | "DIA1" | "DIA2", thunkAPI) => {
|
||||
try {
|
||||
const data = await fetchSystemspannung15VplusService(typ);
|
||||
return { typ, data };
|
||||
} catch (error) {
|
||||
console.error("Fehler in getSystemspannung15VplusThunk:", error);
|
||||
return thunkAPI.rejectWithValue("Fehler beim Laden der +15V-Daten");
|
||||
}
|
||||
}
|
||||
);
|
||||
15
redux/thunks/getSystemspannung98VminusThunk.ts
Normal file
15
redux/thunks/getSystemspannung98VminusThunk.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import { fetchSystemspannung98VminusService } from "@/services/fetchSystemspannung98VminusService";
|
||||
|
||||
export const getSystemspannung98VminusThunk = createAsyncThunk(
|
||||
"systemspannung98Vminus/fetch",
|
||||
async (typ: "DIA0" | "DIA1" | "DIA2", thunkAPI) => {
|
||||
try {
|
||||
const data = await fetchSystemspannung98VminusService(typ);
|
||||
return { typ, data };
|
||||
} catch (error) {
|
||||
console.error("Fehler in getSystemspannung98VminusThunk:", error);
|
||||
return thunkAPI.rejectWithValue("Fehler beim Laden der -98V-Daten");
|
||||
}
|
||||
}
|
||||
);
|
||||
15
redux/thunks/getTemperaturAdWandlerThunk.ts
Normal file
15
redux/thunks/getTemperaturAdWandlerThunk.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import { fetchTemperaturAdWandlerService } from "@/services/fetchTemperaturAdWandlerService";
|
||||
|
||||
export const getTemperaturAdWandlerThunk = createAsyncThunk(
|
||||
"temperaturAdWandler/fetch",
|
||||
async (typ: "DIA0" | "DIA1" | "DIA2", thunkAPI) => {
|
||||
try {
|
||||
const data = await fetchTemperaturAdWandlerService(typ);
|
||||
return { typ, data };
|
||||
} catch (error) {
|
||||
console.error("Fehler in getTemperaturAdWandlerThunk:", error);
|
||||
return thunkAPI.rejectWithValue("Fehler beim Laden der Temperaturdaten");
|
||||
}
|
||||
}
|
||||
);
|
||||
17
redux/thunks/getTemperaturProzessorThunk.ts
Normal file
17
redux/thunks/getTemperaturProzessorThunk.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import { fetchTemperaturProzessorService } from "@/services/fetchTemperaturProzessorService";
|
||||
|
||||
export const getTemperaturProzessorThunk = createAsyncThunk(
|
||||
"temperaturProzessor/fetch",
|
||||
async (typ: "DIA0" | "DIA1" | "DIA2", thunkAPI) => {
|
||||
try {
|
||||
const data = await fetchTemperaturProzessorService(typ);
|
||||
return { typ, data };
|
||||
} catch (error) {
|
||||
console.error("Fehler in getTemperaturProzessorThunk:", error);
|
||||
return thunkAPI.rejectWithValue(
|
||||
"Fehler beim Laden der Prozessor-Temperaturdaten"
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user