How does redux-saga callback to deal with its own business logic?

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))
    }
}
Jul.18,2022

I wonder if that's what you mean: middleware.run
this method should return a promise. Then you can do callback
I used this


when I wrote a server rendering demo when I prefetched the data and returned the rendered page.

I wrote a solution myself:

this.props.dispatch(createTaskGrap({
                    task:{
                        activities: activities,
                        remark: "",
                        srcJson: modelTxt,
                        templateName: "",
                    },
                    // 
                    testFn:()=>{
                        //your do
                    }
            }))

then execute it in saga:

export function* DrawTaskGrapData(actions){
    try{
        yield takeLatest(CREATE_TASKGRAP, DrawTaskGrapData);
        const res = yield call(apifetch, actions.taskGrapObj.task);
        // 
        actions.taskGrapObj.testFn();
        yield put(createTaskGrapSuccess(res.data))
    }catch(error){
        yield put(createTaskGrapFailed(error.message))
    }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b838-2ba90.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b838-2ba90.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?