Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

101
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda