I have to use ofType with more than 5 actions in my effect.
@Effect()
applyInspectionsFilters$: Observable<Action> = this.actions$.pipe(
ofType(
InspectionsPageActions.applyInspectionsFilters.type,
InspectionsPageActions.clearSelectedInspectionsFilters.type,
InspectionsPageActions.removeSelectedStatusFilter.type,
InspectionsPageActions.removeSelectedAttributeFilter.type,
InspectionsPageActions.removeSelectedUserFilter.type,
InspectionsPageActions.removeNotAssignedUsersFilter.type
),
withLatestFrom(
this.store$.pipe(select(fromInspections.getSelectedInspectionsFilters))
),
switchMap(([action, filters]) =>
...
)
);
How should I do this when the maximum number of parameters is 5 in their library?
docs here: https://ngrx.io/api/effects/ofType
show the way to do it is something like this:
ofType(
...[InspectionsPageActions.applyInspectionsFilters.type,
InspectionsPageActions.clearSelectedInspectionsFilters.type,
InspectionsPageActions.removeSelectedStatusFilter.type,
InspectionsPageActions.removeSelectedAttributeFilter.type,
InspectionsPageActions.removeSelectedUserFilter.type,
InspectionsPageActions.removeNotAssignedUsersFilter.type]
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With