WebStudio/src/rootReducer.ts

37 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-11-26 10:01:26 +00:00
import { combineReducers } from "@reduxjs/toolkit";
import { persistReducer, PersistConfig } from "redux-persist";
import webStorage from "redux-persist/lib/storage";
import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
2019-11-26 10:01:26 +00:00
import ShowplanReducer from "./showplanner/state";
2020-03-19 17:49:55 +00:00
import MixerReducer from "./mixer/state";
import BroadcastReducer from "./broadcast/state";
import sessionReducer from "./session/state";
2020-04-03 10:41:34 +00:00
import NavbarReducer from "./navbar/state";
import OptionsMenuReducer from "./optionsMenu/state";
2020-04-10 07:58:53 +00:00
import SettingsState from "./optionsMenu/settingsState";
2019-11-26 10:01:26 +00:00
const rootReducer = combineReducers({
2020-04-19 13:47:19 +00:00
showplan: ShowplanReducer,
mixer: MixerReducer,
broadcast: BroadcastReducer,
session: sessionReducer,
navbar: NavbarReducer,
optionsMenu: OptionsMenuReducer,
settings: SettingsState
2019-11-26 10:01:26 +00:00
});
export type RootState = ReturnType<typeof rootReducer>;
const persistenceConfig: PersistConfig<RootState> = {
2020-04-19 13:47:19 +00:00
key: "root",
storage: webStorage,
whitelist: ["settings"],
stateReconciler: autoMergeLevel2
};
const persistedReducer = persistReducer(persistenceConfig, rootReducer);
export default persistedReducer;