Created
November 19, 2019 22:14
-
-
Save oleersoy/f29bc17dabbc17932b90eae7c17b8cf5 to your computer and use it in GitHub Desktop.
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
constructor(private http: HttpClient) { | |
this.bookStore.observeQuery().pipe(filter(Boolean), | |
debounceTime(200), | |
distinctUntilChanged(), | |
tap(async (query: string) => { | |
const bo: Observable<Book[]> = this.searchAPI(query); | |
const books: Book[] = await bo.toPromise(); | |
this.bookStore.reset(); | |
this.bookStore.postA(books); | |
}) | |
) | |
.subscribe(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment