-
-
Save jtcrowson/191c435185b2dbd46bd3ca6335ae67e7 to your computer and use it in GitHub Desktop.
Adapted book.effects.ts from version 7.3.0 of ngrx/platform
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
@Injectable() | |
export class BookEffects { | |
@Effect({ dispatch: false }) | |
addBookSuccess$ = this.actions$.pipe( | |
ofType(CollectionApiActionTypes.AddBookSuccess), | |
withLatestFrom(this.store.select(fromBooks.getCollectionBookIds)), | |
tap(([action, bookCollection]) => { | |
if (bookCollection.length === 1) { | |
window.alert('Congrats on adding your first book!') | |
} else { | |
window.alert('You have added book number ' + bookCollection.length); | |
} | |
}) | |
); | |
// search$ effect deleted for simplicity | |
constructor( | |
private actions$: Actions<FindBookPageActions.FindBookPageActionsUnion>, | |
// ... | |
private store: Store<fromBooks.State> | |
) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment