Add server api instance
[arvados-workbench2.git] / src / store / store.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
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";
9
10 const composeEnhancers =
11     (process.env.NODE_ENV === 'development' &&
12     window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
13     compose;
14
15 export default function configureStore(initialState: RootState, history: History) {
16     const middlewares: Middleware[] = [
17         routerMiddleware(history)
18     ];
19     const enhancer = composeEnhancers(applyMiddleware(...middlewares));
20     return createStore(rootReducer, initialState!, enhancer);
21 }