ultimatecourses / angular-basics-seed

Angular Basics (v15) Course Seed Project
17 stars 42 forks source link

Use retryWhen() to Delay Retries #3

Open hazartilirot opened 1 year ago

hazartilirot commented 1 year ago

Actually, retryWhen is deprecated. https://rxjs.dev/api/operators/retryWhen

read(): Observable<Donut[]> {
    return this.donuts.length ?
      of(this.donuts) :
      this.httpClient
          .get<Donut[]>(`/api/donuts`)
          .pipe(
            tap(donuts => this.donuts = donuts),
            retry({count: 10, delay: 5000}), // use this operator instead
            catchError(this.handleError)
          );
  }