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";
12 const composeEnhancers =
13 (process.env.NODE_ENV === 'development' &&
14 window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
17 export interface RootState {
19 projects: ProjectState;
23 const rootReducer = combineReducers({
25 projects: projectsReducer,
30 export default function configureStore(initialState: RootState, history: History) {
31 const middlewares: Middleware[] = [
32 routerMiddleware(history),
35 const enhancer = composeEnhancers(applyMiddleware(...middlewares));
36 return createStore(rootReducer, initialState!, enhancer);