diff --git a/libs/openchallenges/challenge/src/lib/challenge-stats/challenge-stats.component.ts b/libs/openchallenges/challenge/src/lib/challenge-stats/challenge-stats.component.ts index 35ac8beb35..410a8aa94d 100644 --- a/libs/openchallenges/challenge/src/lib/challenge-stats/challenge-stats.component.ts +++ b/libs/openchallenges/challenge/src/lib/challenge-stats/challenge-stats.component.ts @@ -1,14 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; -import { - Challenge, - ChallengeService, -} from '@sagebionetworks/openchallenges/api-client-angular'; -import { catchError, Observable, of, switchMap, throwError } from 'rxjs'; -import { - HttpStatusRedirect, - handleHttpError, -} from '@sagebionetworks/openchallenges/util'; +import { Challenge } from '@sagebionetworks/openchallenges/api-client-angular'; +import { Observable } from 'rxjs'; import { CommonModule } from '@angular/common'; import { MatIconModule } from '@angular/material/icon'; @@ -25,32 +17,9 @@ export class ChallengeStatsComponent implements OnInit { mockViews!: number; mockStargazers!: number; - constructor( - private activatedRoute: ActivatedRoute, - private router: Router, - private challengeService: ChallengeService - ) {} - ngOnInit(): void { this.mockViews = 5_000; this.mockStargazers = 2; - - this.challenge$ = this.activatedRoute.params.pipe( - switchMap((params) => - this.challengeService.getChallenge(params['challengeId']) - ), - switchMap((challenge) => { - this.router.navigate(['/challenge', challenge.id, challenge.slug]); - return of(challenge); - }), - catchError((err) => { - const error = handleHttpError(err, this.router, { - 404: '/not-found', - 400: '/challenge', - } as HttpStatusRedirect); - return throwError(() => error); - }) - ); } shorthand(n: number | undefined) { diff --git a/libs/openchallenges/challenge/src/lib/challenge.component.html b/libs/openchallenges/challenge/src/lib/challenge.component.html index 043fd77304..d836b50050 100644 --- a/libs/openchallenges/challenge/src/lib/challenge.component.html +++ b/libs/openchallenges/challenge/src/lib/challenge.component.html @@ -28,24 +28,21 @@