We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mapResponse
operators
Similar to tapResponse, add mapResponse operator to improve response handling in NgRx effects.
tapResponse
Before:
export const loadAllUsers = createEffect(( actions$ = inject(Actions), usersService = inject(UsersService) ) => { return actions$.pipe( ofType(UsersPageActions.opened), exhaustMap(() => { return usersService.getAll().pipe( map((users) => UsersApiActions.usersLoadedSuccess({ users })), catchError((error) => of(UsersApiActions.usersLoadedFailure({ error })) ) ); }) ); });
After:
import { mapResponse } from '@ngrx/operators'; export const loadAllUsers = createEffect(( actions$ = inject(Actions), usersService = inject(UsersService) ) => { return actions$.pipe( ofType(UsersPageActions.opened), exhaustMap(() => { return usersService.getAll().pipe( mapResponse({ next: (users) => UsersApiActions.usersLoadedSuccess({ users }), error: (error) => UsersApiActions.usersLoadedFailure({ error }), }) ); }) ); });
No response
The text was updated successfully, but these errors were encountered:
feat(operators): add mapResponse ngrx#4230
7eb7619
9693f1f
feat(operators): add mapResponse (#4302)
c460920
Closes #4230
Successfully merging a pull request may close this issue.
Which @ngrx/* package(s) are relevant/related to the feature request?
operators
Information
Similar to
tapResponse
, addmapResponse
operator to improve response handling in NgRx effects.Before:
After:
Describe any alternatives/workarounds you're currently using
No response
I would be willing to submit a PR to fix this issue
The text was updated successfully, but these errors were encountered: