I think you should be using compose
function, so it’s like
import {
createStore,
applyMiddleware,
compose
} from 'redux';
import thunk from 'redux-thunk';
import duedates from './reducers/duedates'
export default compose(applyMiddleware(thunk))(createStore)(duedates);
Thunk allows an action creator to return a function instead of plain-object, so you use it like
export function getDueDates() {
return dispatch => {
console.log("IN ACTION");
fetchDueDates().done(
dueDates => dispatch(getDueDatesOptimistic(dueDates.entity._embedded.dueDates))
)
};
}
You were returning a Promise object, that was one part of the problem. Another part was that redux-thunk hasn’t been properly applied. I bet compose
should get the problem solved.