1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-14 07:10:05 +02:00
copilot/legacy/spikes/form/redux-form/client/store.js

30 lines
679 B
JavaScript
Raw Normal View History

const takeRight = require('lodash.takeright');
const redux = require('redux');
const reduxFormReducer = require('redux-form').reducer;
const {
createStore,
compose,
combineReducers,
applyMiddleware
} = redux;
/*const reducer = (state, action) => {
if (action.type !== 'UPDATE_STATS') {
return state;
}
const data = (state.data || []).concat([action.payload]);
return {
...state,
data: takeRight(data, 50)
};
};*/
const reducer = combineReducers({ form: reduxFormReducer });
module.exports = (state = Object.freeze({})) => {
return createStore(reducer, state, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__());
};