我正在尝试在redux sagas中调度一个操作,以向本地商店添加ID:
import { call, takeEvery } from 'redux-saga/effects';
import { BENEFITS } from '../actions/types';
function* addBenefitIdToViewedList(action){
const id = action.payload.isClaimable? 'c'+ action.payload.id : 's'+action.payload.id;
console.log(id)
console.log(action)
console.log(yield call({type: BENEFITS.VIEWED_LIST.ADD, rootAction:action}));
}
export default function*() {
yield takeEvery(BENEFITS.VIEWED_LIST.POST, addBenefitIdToViewedList);
}
我认为问题是“收益率电话”-我应该使用其他方法吗?
当我调试它时,将调用BENEFITS.VIEWED_LIST.POST并相应地打印ID和操作。但是,不会调用BENEFITS.VIEWED_LIST.ADD。我需要打电话,以便减速机可以更新商店。
有什么想法吗?感谢您的帮助!