Created
September 30, 2021 04:00
-
-
Save ardydedase/da07f76c9608d178e4a7e02ef06a50ae to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| this.results$ = this.searchSubject$.pipe( | |
| debounceTime(200), | |
| distinctUntilChanged(), | |
| switchMap((searchString) => { | |
| if ((searchString as any).replace(/\s/g, '')) { | |
| switch (this.searchType) { | |
| case SearchType.REPOS: | |
| return this.githubService.searchRepos(searchString); | |
| case SearchType.USERS: | |
| return this.githubService.searchUsers(searchString); | |
| default: | |
| break; | |
| } | |
| } | |
| }) | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment