Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   search = (text$: Observable<string>) =>
  2.     text$.pipe(
  3.       debounceTime(300),
  4.       distinctUntilChanged(),
  5.       tap(() => (this.searching = true)),
  6.       switchMap(term =>
  7.         term.length < 2
  8.           ? []
  9.           : this.ordersSvc.search(term, this.commaList(this.fulfillment_status), this.commaList(this.payment_status)).pipe(
  10.               tap(() => (this.searchFailed = false)),
  11.               catchError(() => {
  12.                 this.searchFailed = true;
  13.                 return of([]);
  14.               })
  15.             )
  16.       ),
  17.       tap(() => (this.searching = false))
  18.     )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement