Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
rate$ = createEffect(() =>
this.actions.pipe(
ofType(TalksActions.rate),
optimisticUpdate({
run: a => {
return this.backend
.rateTalk(a.talkId, a.rating)
.pipe(switchMap(() => of()));
},
undoAction: (a, e) => {
return TalksActions.unrate({ talkId: a.talkId, error: e });
}
})
)
);