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";
9 import projectsReducer, { ProjectState } from "./project/project-reducer";
10 import authReducer, { AuthState } from "./auth/auth-reducer";
11 import collectionsReducer from "./collection/collection-reducer";
13 const composeEnhancers =
14 (process.env.NODE_ENV === 'development' &&
15 window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
18 export interface RootState {
20 projects: ProjectState;
24 const rootReducer = combineReducers({
26 projects: projectsReducer,
27 collections: collectionsReducer,
32 export default function configureStore(initialState: RootState, history: History) {
33 const middlewares: Middleware[] = [
34 routerMiddleware(history),
37 const enhancer = composeEnhancers(applyMiddleware(...middlewares));
38 return createStore(rootReducer, initialState!, enhancer);