I want to: create a book, then load list of books, then navigate to book detail page
Assume that I have 2 effects: load list book and create book. loadListBook effect work correctly (as before)
My create effect is written correct?
create$: Observable<Action> = this.action$.pipe(
ofType<CreateBook>(BookActions.createBook),
switchMap(action => {
return this.bookService.create(action.payload).pipe(
map(newbook => {
console.log(newbook)
}),
catchError(error => of( {
type: 'CREATE_BOOK_FAILURE'
}))
);
}),
switchMap(bookInfo => [
new LoadBookList()
]),
tap(book => {
// want to navigate to book detail here
console.log(e);
})
);