Skip to content

Instantly share code, notes, and snippets.

@alex-okrushko
Last active March 14, 2019 13:42
Show Gist options
  • Select an option

  • Save alex-okrushko/174ffca3b17c39bbc8cb8055a97eab3f to your computer and use it in GitHub Desktop.

Select an option

Save alex-okrushko/174ffca3b17c39bbc8cb8055a97eab3f to your computer and use it in GitHub Desktop.
// Dispatch is set to false, so this effect will not try to dispatch
// the result of this effect.
@Effect({ dispatch: false })
handleFetchError: Observable<unknown> = this.actions$.pipe(
ofType(actions.FETCH_PRODUCTS_ERROR),
map(() => {
// Setting the timeout, so that angular would re-run change detection.
setTimeout(
() =>
this.snackBar.open('Error fetching products', 'Error', {
duration: 2500,
}),
0
);
})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment