You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
510 B
TypeScript
26 lines
510 B
TypeScript
import { createSlice } from '@reduxjs/toolkit';
|
|
import defaultSettings from '../settings.json';
|
|
|
|
export interface GlobalState {
|
|
settings?: typeof defaultSettings;
|
|
}
|
|
|
|
const initialState: GlobalState = {
|
|
settings: defaultSettings
|
|
};
|
|
|
|
const globalSlice = createSlice({
|
|
name: 'global',
|
|
initialState,
|
|
reducers: {
|
|
updateSettings(state, action) {
|
|
state.settings = action.payload.settings;
|
|
}
|
|
}
|
|
});
|
|
|
|
export const { updateSettings } = globalSlice.actions;
|
|
|
|
export default globalSlice.reducer;
|
|
|