react-redux中的API axios后期调用

时间:2018-09-08 02:19:47

标签: reactjs react-redux redux-thunk

enter image description here [//配置未定义,我可以看到有效载荷中的数据。

动作文件:

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,但不能发布。请帮忙。

0 个答案:

没有答案