Add redux-thunk to package.json

pull/226/head
Rick Carlino 2015-10-01 14:45:44 -05:00
parent eacfaf6e99
commit c953a665c8
4 changed files with 19 additions and 12 deletions

View File

@ -2,7 +2,8 @@ import React from 'react/addons';
import { Provider } from 'react-redux';
import { store } from './redux/store';
import { connect } from 'react-redux';
import { DesignerMain } from './menus/designer_main'
import { DesignerMain } from './menus/designer_main';
function wow (d) {
return {dispatch: d};
}

View File

@ -27,14 +27,18 @@ actions.CROP_ADD_REQUEST = function (s, a) {
var plants = _.cloneDeep(s.global.plants);
var selectedPlant = _.cloneDeep(a.payload);
plants.push(selectedPlant);
return update(s, {
global: {
plants: plants,
selectedPlant: selectedPlant
}
});
return update(s, { global: { plants, selectedPlant } });
};
// function incrementAsync() {
// return dispatch => {
// setTimeout(() => {
// // Yay! Can invoke sync or async actions with `dispatch`
// dispatch(increment());
// }, 1000);
// };
// }
actions.CROP_REMOVE_REQUEST = function (s, a) {
var s = _.cloneDeep(s);
var id = a.payload._id;

View File

@ -1,7 +1,9 @@
import { createStore } from 'redux';
import { createStore, applyMiddleware } from 'redux';
import { reducer } from './reducer';
import thunk from 'redux-thunk';
// var store = createStore(reducer, initialState);
var store = createStore(reducer, window.initialState);
// var store = createStore(reducer, window.initialState);
var store = applyMiddleware(thunk)
(createStore)
(reducer, window.initialState);
export { store };

View File

@ -35,7 +35,7 @@
"react-redux": "^2.1.2",
"reactify": "^1.1.1",
"redux": "^3.0.0",
"redux-router": "^1.0.0-beta3",
"redux-thunk": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
}
}