【发布时间】:2021-02-01 00:24:48
【问题描述】:
我有一个回调,我需要返回 true 或 false 来触发一些外部动作,我需要在这个回调中进行 API 调用,所以我需要在回调中获取状态并调度一些动作,我没有'不知道我是否可以使用 eventChannel,因为这个回调不能是生成器,只能是普通函数。我需要做这样的事情。
zafClient.on('ticket.save', () => {
const state = yield select();
yield put(actionWithApiCall())
// I need to wait for the action to finish and then return something
// based on the response from the API
// I know how to block the saga to wait for the action dispatched
// the problem is that I can't use yield here
return somethingfromthestore;
});
顺便说一句,这是 zendesk API。
【问题讨论】:
标签: javascript reactjs redux redux-saga zendesk