mirror of
https://git.um-react.app/um/um-react.git
synced 2026-11-27 23:56:59 +00:00
feat: setup redux store for settings
This commit is contained in:
1 parent
953f0d524d
commit
b136bac9b6
9 files changed
+150
-14
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
import type { PayloadAction } from '@reduxjs/toolkit';
|
||||
|
||||
export interface QMCSettings {
|
||||
keys: Record<string, string>; // { [fileName]: ekey }
|
||||
}
|
||||
|
||||
export interface SettingsState {
|
||||
qmc2: QMCSettings;
|
||||
}
|
||||
|
||||
const initialState: SettingsState = {
|
||||
qmc2: { keys: {} },
|
||||
};
|
||||
|
||||
export const settingsSlice = createSlice({
|
||||
name: 'settings',
|
||||
initialState,
|
||||
reducers: {
|
||||
updateSettings: (_state, { payload }: PayloadAction<SettingsState>) => {
|
||||
return payload;
|
||||
},
|
||||
resetConfig: () => {
|
||||
return initialState;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { updateSettings, resetConfig } = settingsSlice.actions;
|
||||
|
||||
export default settingsSlice.reducer;
|
||||
Reference in new issue
Block a user