2019-11-26 10:01:26 +00:00
|
|
|
import { combineReducers } from "@reduxjs/toolkit";
|
|
|
|
|
2020-04-10 08:04:42 +00:00
|
|
|
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";
|
2020-03-26 11:51:18 +00:00
|
|
|
import BroadcastReducer from "./broadcast/state";
|
2020-03-29 00:07:07 +00:00
|
|
|
import sessionReducer from "./session/state";
|
2020-04-03 10:41:34 +00:00
|
|
|
import NavbarReducer from "./navbar/state";
|
2020-04-03 14:23:03 +00:00
|
|
|
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>;
|
|
|
|
|
2020-04-10 08:04:42 +00:00
|
|
|
const persistenceConfig: PersistConfig<RootState> = {
|
2020-04-19 13:47:19 +00:00
|
|
|
key: "root",
|
|
|
|
storage: webStorage,
|
|
|
|
whitelist: ["settings"],
|
|
|
|
stateReconciler: autoMergeLevel2
|
2020-04-10 08:04:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const persistedReducer = persistReducer(persistenceConfig, rootReducer);
|
|
|
|
|
|
|
|
export default persistedReducer;
|