for example, how to handle the callback of redux-saga, call your own method, for example, clear the input of the form after executing saga, or pop up the success message box, or jump to the page, etc.
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))
}
}