Created
February 11, 2019 09:34
-
-
Save yinonov/3ff154e7b3e1e7e37e280af52aa5682d to your computer and use it in GitHub Desktop.
code example for preserving cart state article
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onLoad$ = this.auth.user$.pipe( | |
take(1), // we only do this once as we only want to handle the initial load | |
switchMap(user => !!user ? mergedCartStates$ : cartStateFromStorage$), | |
// set the cart form with the retrieved state's value | |
tap(setCartValue) // set the cart's form with emitted value | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment