1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { createStore, applyMiddleware, compose, Middleware } from 'redux';
6 import { default as rootReducer, RootState } from "./root-reducer";
7 import { routerMiddleware } from "react-router-redux";
8 import { History } from "history";
10 const composeEnhancers =
11 (process.env.NODE_ENV === 'development' &&
12 window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
15 export default function configureStore(initialState: RootState, history: History) {
16 const middlewares: Middleware[] = [
17 routerMiddleware(history)
19 const enhancer = composeEnhancers(applyMiddleware(...middlewares));
20 return createStore(rootReducer, initialState!, enhancer);