Created
September 30, 2021 04:02
-
-
Save ardydedase/12606c646ffddc9f21f00699064b108e 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
import { Injectable } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import { map } from 'rxjs/operators'; | |
@Injectable() | |
export class GithubService { | |
constructor(private http: HttpClient) {} | |
public searchRepos(searchString) { | |
return this.http | |
.get(`https://api.github.com/search/repositories?q=${searchString}`) | |
.pipe(map((result) => result['items'])); | |
} | |
public searchUsers(searchString) { | |
console.log('search users..'); | |
return this.http | |
.get(`https://api.github.com/search/users?q=${searchString}`) | |
.pipe(map((result) => result['items'])); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment