我有下面的史诗文件,这是有以下功能,
我需要从onUndo调用action,但是正如看到的,action. showwarnToast已经被分派,因为另一个action没有分派
export const makeXDiningReservation = createDataEpic({
name: "makeXDiningReservation",
apiPath: (action, state) =>
generatePath("pathToApi", {
}),
apiOptions: (action, state) => {
return {
headers: {
"Client-Id": "ship",
"Content-Type": "application/json",
},
body: JSON.stringify(data),
};
},
successActionCreator: (
response,
state,
action,
{ getIntl, ...rest },
...params
) => {
if (isDailyPlannerEnabled && eventOverlap) {
return [
Actions.throttledScheduleRefresh({ force: true }),
Actions.diningReservationSuccessOnShip({
...action,
reservationID: response.bookingId,
}),
Actions.navigateReplace({
pathname: generatePath("path", {
restaurantKey: action.restaurantKey,
}),
state: {
action,
response: { ...response, reservationID: response.bookingId },
},
}),
Actions.showWarnToastMessage(
getIntl(state).formatMessage(
strings.activityOverlapsWithAnotherActivity,
),
{
color: "warning",
variant: "standard",
showUndo: true,
undoData: response,
onUndo: (data) => {
return [
Actions.navigatePush({
pathname: generatePath("/dailyPlanner"),
}),
modalActivityActionDrawerActions.setModalState(true),
];
},
},
),
];
} else {
return [
Actions.diningReservationSuccessOnShip({
...action,
reservationID: response.bookingId,
}),
Actions.navigateReplace({
pathname: generatePath("/dining/:restaurantKey/confirm", {
restaurantKey: action.restaurantKey,
}),
state: {
action,
response: { ...response, reservationID: response.bookingId },
},
}),
];
}
},
failureActionCreator: (error, state, action) => [
Actions.epicError(makeXDiningReservation.name, error),
stopSubmit(action.form, { _error: error }),
],
triggeringActions: [START_DINING_RESERVATION],
type: REQUEST_TYPE.POST_JSON,
waitingIdentifier: "DINING_RESERVATION",
});
我试着像这样调度,但它没有工作帮助我修复它,因为我不知道这将如何工作,最终我希望这是从史诗的一面完成.
onUndo: (data) => {
return [
Actions.navigatePush({ pathname: generatePath("/dailyPlanner") }),
modalActivityActionDrawerActions.setModalState(true),
];
};