如题,如何处理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'const apifetch = (drawTaskGrap) => { return fetch('drawTaskGrap', drawTaskGrap) }export function* DrawTaskGrapData(actions){ try{ yield takeLatest(CREATE_TASKGRAP, DrawTaskGrapData); const res = yield call(apifetch, actions.taskGrapObj); console.log('draw task grap saga = ', res); yield put(createTaskGrapSuccess(res.data)) }catch(error){ yield put(createTaskGrapFailed(error.message)) } }
人到中年有点甜
相关分类