如题,如何处理redux-saga的回调,调用自己的方法,比如,执行了saga后清除表单的输入,或者弹出成功信息框,或者跳转页面等等import{call,put,takeLatest}from'redux-saga/effects'import{fetch}from'@/util/request'import{message}from'antd'import{push}from'react-router-redux'import{CREATE_TASKGRAP,createTaskGrapSuccess,createTaskGrapFailed}from'../../actions/drawTaskGrapAction'constapifetch=(drawTaskGrap)=>{returnfetch('drawTaskGrap',drawTaskGrap)}exportfunction*DrawTaskGrapData(actions){try{yieldtakeLatest(CREATE_TASKGRAP,DrawTaskGrapData);constres=yieldcall(apifetch,actions.taskGrapObj);console.log('drawtaskgrapsaga=',res);yieldput(createTaskGrapSuccess(res.data))}catch(error){yieldput(createTaskGrapFailed(error.message))}}
忽然笑
相关分类