@koalarx/ui 13.2.1 → 13.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -470,21 +470,20 @@ class KoalaOAuth2Service {
470
470
  }, 300);
471
471
  }
472
472
  initRefreshTokenInterval(code, refreshToken) {
473
- if (!this.refreshTokenInterval) {
474
- this.refreshTokenInterval = interval(1000).subscribe(() => {
475
- const refreshTokenDate = new Date();
476
- refreshTokenDate.setMinutes(refreshTokenDate.getMinutes() + 1);
477
- const token = this.tokenService.getOAuth2Token();
478
- if (token) {
479
- const expires_in = token.expired;
480
- if (expires_in) {
481
- if (new Date(expires_in) <= refreshTokenDate) {
482
- this.getToken(code, refreshToken);
483
- }
473
+ this.refreshTokenInterval?.unsubscribe();
474
+ this.refreshTokenInterval = interval(1000).subscribe(() => {
475
+ const refreshTokenDate = new Date();
476
+ refreshTokenDate.setMinutes(refreshTokenDate.getMinutes() + 1);
477
+ const token = this.tokenService.getOAuth2Token();
478
+ if (token) {
479
+ const expires_in = token.expired;
480
+ if (expires_in) {
481
+ if (new Date(expires_in) <= refreshTokenDate) {
482
+ this.getToken(code, refreshToken);
484
483
  }
485
484
  }
486
- });
487
- }
485
+ }
486
+ });
488
487
  }
489
488
  getToken(code, refreshToken) {
490
489
  if (refreshToken) {