WebStudio/src/rootReducer.ts

40 lines
1.2 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";
2021-05-31 19:57:11 +00:00
import BroadcastReducer from "./broadcast/state";
import sessionReducer from "./session/state";
import OptionsMenuReducer from "./optionsMenu/state";
import SettingsState from "./optionsMenu/settingsState";
2020-04-03 10:41:34 +00:00
import NavbarReducer from "./navbar/state";
2019-11-26 10:01:26 +00:00
2021-05-31 19:57:11 +00:00
import BAPSSessionReducer from "./bapsiclesession/state";
2019-11-26 10:01:26 +00:00
const rootReducer = combineReducers({
2020-04-19 13:47:19 +00:00
showplan: ShowplanReducer,
mixer: MixerReducer,
2021-05-31 19:57:11 +00:00
broadcast: BroadcastReducer,
2020-04-19 13:47:19 +00:00
session: sessionReducer,
navbar: NavbarReducer,
2021-05-31 19:57:11 +00:00
optionsMenu: OptionsMenuReducer,
settings: SettingsState,
bapsSession: BAPSSessionReducer,
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"],
2020-04-19 16:33:34 +00:00
stateReconciler: autoMergeLevel2,
};
const persistedReducer = persistReducer(persistenceConfig, rootReducer);
export default persistedReducer;