taxtank-core 0.30.88 → 0.30.89

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.
@@ -9797,6 +9797,7 @@ let RestService$1 = class RestService extends DataService {
9797
9797
  .pipe(map((response) => this.isApiPlatform ? response['hydra:member'] : toArray(response)), map((response) => {
9798
9798
  this.setCache(response);
9799
9799
  this.cacheSubject.next(this.cache);
9800
+ this.isPending = false;
9800
9801
  return this.cache;
9801
9802
  }));
9802
9803
  }
@@ -10260,20 +10261,14 @@ class BasiqTokenService extends RestService$1 {
10260
10261
  * Access token to use basiq flow
10261
10262
  */
10262
10263
  get() {
10263
- // @TODO Alex move isPending to restService
10264
- if ((!this.cache || this.cache.first.isExpired()) && !this.isPending) {
10265
- this.isPending = true;
10266
- this.http.get(this.apiUrl)
10267
- .pipe(map((response) => {
10268
- const now = new Date().getTime();
10269
- return new BasiqToken(response.access_token, new Date(now + response.expires_in * 1000));
10270
- }))
10271
- .subscribe((token) => {
10272
- this.isPending = false;
10273
- this.updateCache([token], 'get');
10274
- });
10264
+ if (this.cache && this.cache.first.isExpired()) {
10265
+ this.setCache([]);
10275
10266
  }
10276
- return this.cacheSubject.asObservable();
10267
+ return super.get();
10268
+ }
10269
+ createModelInstance(tokenResponse) {
10270
+ const now = new Date().getTime();
10271
+ return new BasiqToken(tokenResponse['access_token'], new Date(now + tokenResponse['expires_in'] * 1000));
10277
10272
  }
10278
10273
  }
10279
10274
  BasiqTokenService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: BasiqTokenService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });