Files
CPLv4.0/redux/slices/systemSettingsSlice.ts
ISA 20e20dec30 feat(redux): Rename all Redux slices and store keys to match file names for clarity
- 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
2025-04-01 12:26:41 +02:00

51 lines
1.1 KiB
TypeScript

// /redux/slices/systemSettingsSlice.ts
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
interface SystemSettingsState {
deviceName: string | null;
mac1: string | null;
ip: string | null;
subnet: string | null;
gateway: string | null;
cplInternalTimestamp: string | null;
ntp1: string | null;
ntp2: string | null;
ntp3: string | null;
ntpTimezone: string | null;
ntpActive: boolean | null;
appVersion: string | null;
}
const initialState: SystemSettingsState = {
deviceName: "",
mac1: "",
ip: "",
subnet: "",
gateway: "",
cplInternalTimestamp: "",
ntp1: "",
ntp2: "",
ntp3: "",
ntpTimezone: "",
ntpActive: false,
appVersion: "",
};
const systemSettingsSlice = createSlice({
name: "systemSettingsSlice",
initialState,
reducers: {
setSystemSettings: (
state,
action: PayloadAction<Partial<SystemSettingsState>>
) => {
return { ...state, ...action.payload };
},
resetSystemSettings: () => initialState,
},
});
export const { setSystemSettings, resetSystemSettings } =
systemSettingsSlice.actions;
export default systemSettingsSlice.reducer;