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

99
Views
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
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!