I'm trying to show a confirmation Modal, before deleting a line using RxJS.
- The code below works fine if I delete 1 line.
- When I delete a second line, then
deleteLineFulfilledis called 2 times. - If I delete a third line, then
deleteLineFulfilledis called 3 times and so on...
Any idea why?
const deleteLineEpic = (action$, store) =>
action$.ofType(DELETE_LINE_REQUEST)
.flatMap((action) => Observable.merge(
Observable.of(showModalYesNo('CONFIRM_DELETE')),
action$.ofType(MODAL_YES_CLICKED).map(() =>
deleteLineFulfilled(action.line)
)
.takeUntil(action$.ofType(MODAL_NO_CLICKED))
));