Skip to content

Instantly share code, notes, and snippets.

@yinonov
Created February 11, 2019 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yinonov/dc8393ce9059df188dfe45b136e172d2 to your computer and use it in GitHub Desktop.
Save yinonov/dc8393ce9059df188dfe45b136e172d2 to your computer and use it in GitHub Desktop.
code example for preserving cart state article
userChange$ = this.auth.user$.pipe(
skip(1), // skip the initial emit to let the onLoad$ do its verification first
);
cartReset$ = this.userChange$.pipe(
filter((user: User) => !user),
tap(() => this.setCartValue({ cartItems: [] })),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment