1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { createStore, applyMiddleware, compose, Middleware, combineReducers } from 'redux';
6 import { routerMiddleware, routerReducer, RouterState } from "react-router-redux";
7 import thunkMiddleware from 'redux-thunk';
8 import { History } from "history";
10 import projectsReducer, { ProjectState } from "./project/project-reducer";
11 import sidePanelReducer, { SidePanelState } from './side-panel/side-panel-reducer';
12 import authReducer, { AuthState } from "./auth/auth-reducer";
13 import dataExplorerReducer, { DataExplorerState } from './data-explorer/data-explorer-reducer';
14 import collectionsReducer, { CollectionState } from "./collection/collection-reducer";
16 const composeEnhancers =
17 (process.env.NODE_ENV === 'development' &&
18 window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
21 export interface RootState {
23 projects: ProjectState;
24 collections: CollectionState;
26 dataExplorer: DataExplorerState;
27 sidePanel: SidePanelState;
30 const rootReducer = combineReducers({
32 projects: projectsReducer,
33 collections: collectionsReducer,
34 router: routerReducer,
35 dataExplorer: dataExplorerReducer,
36 sidePanel: sidePanelReducer
40 export default function configureStore(history: History) {
41 const middlewares: Middleware[] = [
42 routerMiddleware(history),
45 const enhancer = composeEnhancers(applyMiddleware(...middlewares));
46 return createStore(rootReducer, enhancer);