Skip to content

Instantly share code, notes, and snippets.

@IAfanasovMob
Created October 8, 2019 12:01
Show Gist options
  • Save IAfanasovMob/d7420c3192423841ce5b928ba6562c1d to your computer and use it in GitHub Desktop.
Save IAfanasovMob/d7420c3192423841ce5b928ba6562c1d to your computer and use it in GitHub Desktop.
loadStarred() {
this.http.get<Repo[]>(`https://api.github.com/users/${this.userName}/starred`)
.pipe(
tap(
response => {
this.repos = response;
this.errorMessage = null;
}
),
catchError(error => {
this.repos = [];
this.errorMessage = error && error.error && error.error.message || 'Unknown error';
return of([]);
})
)
.subscribe();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment