- Renamed all slice names (createSlice `name` attribute) to match their file names (e.g. loopChartSlice, authSlice, kueDataSlice etc.) - Updated `store.ts` to register each reducer with consistent key names (e.g. state.loopChartSlice instead of state.loopChart) - Adjusted all `useSelector` and Redux state accesses across the codebase - Improves maintainability, searchability and consistency across files and Redux DevTools
33 lines
882 B
TypeScript
33 lines
882 B
TypeScript
// redux/slices/webVersionSlice.ts
|
|
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
|
import webVersion from "../../config/webVersion";
|
|
|
|
interface WebVersionState {
|
|
version: string;
|
|
}
|
|
|
|
const initialState: WebVersionState = {
|
|
version: webVersion,
|
|
};
|
|
|
|
const webVersionSlice = createSlice({
|
|
name: "webVersionSlice",
|
|
initialState,
|
|
reducers: {
|
|
setWebVersion(state, action: PayloadAction<string>) {
|
|
state.version = action.payload;
|
|
},
|
|
incrementBuild(state) {
|
|
// Versionsnummer zerlegen und Build hochzählen
|
|
const parts = state.version.split(".");
|
|
if (parts.length === 3) {
|
|
parts[2] = (parseInt(parts[2]) + 1).toString(); // Build hochzählen
|
|
state.version = parts.join(".");
|
|
}
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { setWebVersion, incrementBuild } = webVersionSlice.actions;
|
|
export default webVersionSlice.reducer;
|