Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mergeMap service in rxjs 6

I am trying to upgrade my project based on some template from angular 5 to 6

one of the method return mergeMap in this way

return this.accountEndpoint.getUserByUserNameEndpoint<User>(userOrUserId.userName)
                    .mergeMap(user => this.deleteUser(user.id));

and some other in this way return

 this.accountEndpoint.getDeleteUserEndpoint<User>(<string>userOrUserId)
                 .do(data => this.onRolesUserCountChanged(data.roles));

unfortunately mergeMap and do does not exists on observable in rxjs 6

Couuld give me a hint how should this be mapped in new worlds of rxjs 6 ?

like image 358
kosnkov Avatar asked Jan 02 '23 05:01

kosnkov


1 Answers

The do operator was renamed to tap, but mergeMap still exists in RxJs 6:

import { tap, mergeMap } from 'rxjs/operators'

sourceObservable.pipe(
  tap(e => ...),
  mergeMap(e => ...)
)
like image 181
Sam Herrmann Avatar answered Jan 23 '23 04:01

Sam Herrmann