2017-04-07 07:15:22 +02:00
|
|
|
const redux = require('redux');
|
|
|
|
const thunk = require("redux-thunk").default;
|
|
|
|
const env = process.env.NODE_ENV || 'development';
|
|
|
|
|
|
|
|
import {
|
|
|
|
createLogger
|
|
|
|
} from 'redux-logger'
|
|
|
|
import appReducer from 'reducers/app';
|
2017-04-23 11:56:50 +02:00
|
|
|
import contentReducer from 'reducers/content';
|
2017-04-24 09:25:27 +02:00
|
|
|
import rewardsReducer from 'reducers/rewards'
|
2017-04-22 15:17:01 +02:00
|
|
|
import walletReducer from 'reducers/wallet'
|
2017-04-07 07:15:22 +02:00
|
|
|
|
|
|
|
function isFunction(object) {
|
|
|
|
return typeof object === 'function';
|
|
|
|
}
|
|
|
|
|
|
|
|
function isNotFunction(object) {
|
|
|
|
return !isFunction(object);
|
|
|
|
}
|
|
|
|
|
|
|
|
const reducers = redux.combineReducers({
|
|
|
|
app: appReducer,
|
2017-04-23 11:56:50 +02:00
|
|
|
content: contentReducer,
|
2017-04-24 09:25:27 +02:00
|
|
|
rewards: rewardsReducer,
|
2017-04-22 15:17:01 +02:00
|
|
|
wallet: walletReducer,
|
2017-04-07 07:15:22 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
var middleware = [thunk]
|
|
|
|
|
|
|
|
if (env === 'development') {
|
|
|
|
const logger = createLogger({
|
|
|
|
collapsed: true
|
|
|
|
});
|
|
|
|
middleware.push(logger)
|
|
|
|
}
|
|
|
|
|
2017-04-24 09:25:27 +02:00
|
|
|
const createStoreWithMiddleware = redux.compose(
|
2017-04-07 07:15:22 +02:00
|
|
|
redux.applyMiddleware(...middleware)
|
|
|
|
)(redux.createStore);
|
|
|
|
|
2017-04-24 09:25:27 +02:00
|
|
|
const reduxStore = createStoreWithMiddleware(reducers);
|
2017-04-07 07:15:22 +02:00
|
|
|
|
|
|
|
export default reduxStore;
|