Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Component({
- selector: 'commits-with-service',
- templateUrl: './commits-with-service.component.html',
- styleUrls: ['./commits-with-service.component.scss'],
- changeDetection: ChangeDetectionStrategy.OnPush
- })
- export class CommitsWithServiceComponent {
- commits$: Observable<Commit[]> = of([]);
- failures: Failure[] = [];
- constructor(private commitsService: CommitsService) { }
- search(username: string) {
- this.commits$ = this.commitsService.readCommitsByUsername(username)
- .pipe(
- tap(this.resetFailure),
- catchError(this.handleFailure)
- );
- }
- resetFailure = () => {
- this.failures = [];
- }
- handleFailure = () => {
- this.failures = [new Failure('Oh dear! Something went wrong, we are sorry!')];
- return of([]);
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement