Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

82
Views
Compruebe si la respuesta no se devolvió en 8 segundos

Tengo un método en mi componente Angular, que devuelve datos.

Aquí está este método

 getRecognitionById() { this.loaderService.show(null, true); forkJoin( this.vendorWebApiService.getRecognitionById(this.executiveChangeId), this.vendorWebApiService.getLatestFeedback(this.executiveChangeId)).pipe(take(1)) .subscribe(res => { this.recognitionData = res[0]; this.latestFeedback = res[1]; this.generateResponseFeedbackGroup(); this.loaderService.hide(true); }); }

Necesito verificar si la respuesta no apareció en 8 segundos, alertar al usuario como alert(response.exceptionMessage);

¿Como puedo hacer esto?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Podrías usar el operador de timeout de espera:

 // import { throwError, TimeoutError } from 'rxjs'; // import { catchError, timeout } from 'rxjs/operators'; getRecognitionById() { this.loaderService.show(null, true); forkJoin( this.vendorWebApiService.getRecognitionById(this.executiveChangeId), this.vendorWebApiService.getLatestFeedback(this.executiveChangeId)).pipe( take(1), timeout(8000), catchError((err) => { if (err instanceof TimeoutError) { // alert(response.exceptionMessage); } return throwError(err); }), ) .subscribe(res => { this.recognitionData = res[0]; this.latestFeedback = res[1]; this.generateResponseFeedbackGroup(); this.loaderService.hide(true); }); }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!