Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

100
Vistas
Time interval not existing after the desired response it wait until the entire interval to be completed

By passing an ID for 60 seconds as payload in an API for getting the status of a transaction. API will give statuses Progress , Completed and Failed. If response is "Progress" it has to run the timer until "Success" / "Failure" and need to exit the timer.

1. The issues right now are even if API gives "Success" / "Failure" it will not exit the timer it keep on loading for one minute.

2. If API get failed it will be in a never ending loop.

I tried adding routing after the response is "Success" / "Failure" for that also it is waiting for 60 S.

intervalVal=interval(50000)

checkstatus(id) {
  this.timeInterval = this.intervalVal.subscribe(() => {
    this.transactionstat(id).subscribe((statres: any) => {
      switch (statres.status) {
        case "progress":
          this.stepper.selectedIndex = 0;
        case "Sucess":
          this.steppershow = false;
          this.stepper.selectedIndex = 1;
          this.stepper.selectedIndex = 2;
          this.timeInterval.unsubscribe()
          setTimeout(() => {
            this.router.navigateByUrl("/home");
          }, 3000);
          break;
        case "Failed":
          this.stepper.selectedIndex = 1;
          this.stepper.selectedIndex = 3;
          this.timeInterval.unsubscribe()
          setTimeout(() => {
            this.router.navigateByUrl("/home");
          }, 3000);
          break;
      }
    })
  });
}

My requirement is to exit the timer after the desired response not to wait for the entire one minute and exit timer after one minute. Help with your valuable suggestions.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda