Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6288

Can i use two mergeMap together in RxJs

$
0
0

I have been started using RxJs with redux and i have created a stream which is working. Here's my action pipe:

action$.pipe(            ofType(DELETE_CALL_HISTORY),            withLatestFrom(state$),            mergeMap(() =>                fromPromise(accessService.getCallHistory()).pipe(                    mergeMap((res: any) => of(deleteCallHistory(res))),                    mergeMap((res: any) => of(setCallHistory(res.param))),                    catchError((err: any) => {                        console.error(err);                        return of(                            showErrorAndHideAfterDelay({                                message: err,                                label: 'Error',                            }),                        );                    }),                ),            ),        ),

Here i have been trying to use three actions. getCallHistory action is fetching the data first. deleteCallHistory action is deleting an item from the list. The action pipe is working till here. After this, i'm trying to set the updated list with the actionsetCallHistory. But this is not working. The setCallHistory action is getting called but when i reload the app, the deleted items are back. Should i use mergeMap like this twice or do need to use anything else?


Viewing all articles
Browse latest Browse all 6288

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>