Skip to content

Instantly share code, notes, and snippets.

@oleersoy
Created November 19, 2019 22:14
Show Gist options
  • Save oleersoy/f29bc17dabbc17932b90eae7c17b8cf5 to your computer and use it in GitHub Desktop.
Save oleersoy/f29bc17dabbc17932b90eae7c17b8cf5 to your computer and use it in GitHub Desktop.
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