2019-11-26 10:01:26 +00:00
|
|
|
import rootReducer, { RootState } from "./rootReducer";
|
2020-03-19 22:24:00 +00:00
|
|
|
import { configureStore, Action, getDefaultMiddleware } from "@reduxjs/toolkit";
|
2019-11-26 10:01:26 +00:00
|
|
|
import { ThunkAction } from "redux-thunk";
|
2020-03-19 22:24:00 +00:00
|
|
|
import { mixerMiddleware, mixerKeyboardShortcutsMiddleware } from "./mixer/state";
|
2019-11-26 10:01:26 +00:00
|
|
|
|
|
|
|
const store = configureStore({
|
2020-03-19 22:24:00 +00:00
|
|
|
reducer: rootReducer,
|
|
|
|
middleware: [...getDefaultMiddleware(), mixerMiddleware, mixerKeyboardShortcutsMiddleware]
|
2019-11-26 10:01:26 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === "development" && module.hot) {
|
|
|
|
module.hot.accept("./rootReducer", () => {
|
|
|
|
const newRootReducer = require("./rootReducer").default;
|
|
|
|
store.replaceReducer(newRootReducer);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export type AppDispatch = typeof store.dispatch;
|
|
|
|
export type AppThunk = ThunkAction<void, RootState, null, Action<string>>;
|
|
|
|
export default store;
|