monkey-front-core 0.0.216 → 0.0.219

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.
@@ -4703,12 +4703,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
4703
4703
  }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }, { type: MonkeyEcxErrorHandlingService }]; } });
4704
4704
 
4705
4705
  class MonkeyEcxHttpConfigHeaderInterceptor {
4706
- constructor(authService, config) {
4706
+ constructor(authService, errorHandlingService, config) {
4707
4707
  this.authService = authService;
4708
+ this.errorHandlingService = errorHandlingService;
4708
4709
  this.config = config;
4709
4710
  // not to do
4710
4711
  }
4711
- async handle(request, next) {
4712
+ async handle(request) {
4712
4713
  const { url } = request;
4713
4714
  if (this.authService.isTokenMandatory(url)) {
4714
4715
  try {
@@ -4723,17 +4724,36 @@ class MonkeyEcxHttpConfigHeaderInterceptor {
4723
4724
  // not to do
4724
4725
  }
4725
4726
  }
4726
- return this.authService.getRequestWithHeaders(request);
4727
+ const resp = await this.authService
4728
+ .getRequestWithHeadersOb(request)
4729
+ .pipe(take(1), map((event) => {
4730
+ return event;
4731
+ }), catchError((error) => {
4732
+ this.errorHandlingService.handleError(error);
4733
+ return throwError(error);
4734
+ }))
4735
+ .toPromise();
4736
+ return resp;
4727
4737
  }
4728
4738
  intercept(request, next) {
4729
- return from(this.handle(request, next));
4739
+ return from(this.handle(request)).pipe(take(1), map((event) => {
4740
+ return event;
4741
+ }), mergeMap((resp) => {
4742
+ request = request.clone({
4743
+ setHeaders: resp
4744
+ });
4745
+ return next.handle(request);
4746
+ }), catchError((error) => {
4747
+ this.errorHandlingService.handleError(error);
4748
+ return throwError(error);
4749
+ }));
4730
4750
  }
4731
4751
  }
4732
- MonkeyEcxHttpConfigHeaderInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor, deps: [{ token: MonkeyEcxAuthenticationService }, { token: MonkeyEcxConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
4752
+ MonkeyEcxHttpConfigHeaderInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor, deps: [{ token: MonkeyEcxAuthenticationService }, { token: MonkeyEcxErrorHandlingService }, { token: MonkeyEcxConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
4733
4753
  MonkeyEcxHttpConfigHeaderInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor });
4734
4754
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxHttpConfigHeaderInterceptor, decorators: [{
4735
4755
  type: Injectable
4736
- }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }, { type: MonkeyEcxConfigService }]; } });
4756
+ }], ctorParameters: function () { return [{ type: MonkeyEcxAuthenticationService }, { type: MonkeyEcxErrorHandlingService }, { type: MonkeyEcxConfigService }]; } });
4737
4757
 
4738
4758
  /* eslint-disable max-len */
4739
4759
  class MonkeyEcxHttpConfigQueueInterceptor {