diff --git a/src/data/configureStore.tsx b/src/data/configureStore.tsx new file mode 100644 index 0000000..dbee315 --- /dev/null +++ b/src/data/configureStore.tsx @@ -0,0 +1,32 @@ +import { applyMiddleware, compose, createStore } from 'redux'; +import { createBrowserHistory } from 'history'; +import { routerMiddleware } from 'connected-react-router'; +import { createRootReducer } from './rootReducer'; + +const history = createBrowserHistory(); + +const rootReducer = createRootReducer(history); + +declare global { + interface Window { + __REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: typeof compose; + } +} + +const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; + + +export default function configureStore() { + const store = createStore( + rootReducer, + compose( + applyMiddleware(routerMiddleware(history)), + composeEnhancers + ) + ); + + return { + store, + history, + }; +} diff --git a/src/data/rootActionTypes.tsx b/src/data/rootActionTypes.tsx new file mode 100644 index 0000000..7fb93d9 --- /dev/null +++ b/src/data/rootActionTypes.tsx @@ -0,0 +1 @@ +export * from './users/actionTypes' diff --git a/src/data/rootActions.tsx b/src/data/rootActions.tsx new file mode 100644 index 0000000..edfd7fe --- /dev/null +++ b/src/data/rootActions.tsx @@ -0,0 +1,4 @@ +import { routerActions as router } from 'connected-react-router' +import * as user from './users/actions' + +export { router, user } diff --git a/src/data/rootReducer.tsx b/src/data/rootReducer.tsx new file mode 100644 index 0000000..15a9c49 --- /dev/null +++ b/src/data/rootReducer.tsx @@ -0,0 +1,11 @@ +import { connectRouter } from 'connected-react-router' +import { combineReducers } from 'redux' +import user from './users/reducers' + +const createRootReducer = (history) => + combineReducers({ + router: connectRouter(history), + user, + }) + +export { createRootReducer } diff --git a/src/data/rootSelectors.tsx b/src/data/rootSelectors.tsx new file mode 100644 index 0000000..02b1651 --- /dev/null +++ b/src/data/rootSelectors.tsx @@ -0,0 +1,3 @@ +import * as users from './users/selectors' + +export { users }