动作文件:
export const fetchConfig = () => dispatch => {
// state will come from redux
console.log("CONFIG ACTION");
let page = store.getState().clients.currentPage;
axios.post('/getlisttags/' + page, store.getState().clients.filters)
.then(config => dispatch({
type: FETCH_CONFIG,
key: page,
paylaod: config.data
}));
};
//Reducer.js
case FETCH_CONFIG: {
console.log('CONFIG REDUCER');
return {
...state,
config: action.payload
}
}
//Component.js
const mapStateToProps = state =>({
configurations:state.clients.config
});
//组合减速器: 导出默认的CombineReducers({ 客户:listingPageReducer })
我能够获取axios.get,但不能发布。请帮忙。