'How can i request it multiple with redux-saga
// dispatch(cartsActions.deleteCartItem.request) - saga looks this request action
deleteSelectedCartItem();
// axios.post('/orders, .....)
ordersRequest.addOrderItem(selectedCartItems);
I want to run these two when a button is clicked. So I put these together in the click event handler. DeleteSelectedCartItem works well normally. But the axios.post part doesn't work.
So I chekced the network tab.
The order is the part about the axios request, and the number is the request related to delete (if there are four items, send the deletion request number 4).
What's the problem? I'd appreciate it if you could help me.
+) deleteCartItemByIdSaga
export function* deleteCartItemByIdSaga({
payload: { idToDeleteCartItem },
}: PayloadAction<DeleteCartItemRequestPayload>) {
try {
yield call(cartsRequest.deleteCartItemById, idToDeleteCartItem);
yield put(cartsActions.deleteCartItemById.success({ deletedCartItemId: idToDeleteCartItem }));
} catch (error) {
if (error instanceof Error) {
yield put(cartsActions.deleteCartItemById.failure({ error }));
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

