-1

I'm calling some API call on submit, due to internet connection interrupt failed API calls. I need to re-send failed API's on re-connection.

Rahul Dapke
  • 345
  • 6
  • 19

1 Answers1

1

You can use the rxjs retry / retryWhen operator

https://www.learnrxjs.io/operators/error_handling/retry.html https://www.learnrxjs.io/operators/error_handling/retrywhen.html


Edit:

return next.handle(req).pipe(
  retry(/***/),
MoxxiManagarm
  • 8,735
  • 3
  • 14
  • 43
  • I can't write retry/retry When on each and every service call . I want this to be handle by interceptor – Rahul Dapke Dec 09 '19 at 11:29
  • Yes you can. You need to pipe the next.handle, I will add it in the answer – MoxxiManagarm Dec 09 '19 at 12:12
  • How to define delay or retry attempt's? because, I can't decision making on retry operation. suppose internet connection interrupt and re-connection after long time.so delay or retry will not work. – Rahul Dapke Dec 10 '19 at 06:03