ngx-techlify-core 11.4.5-beta.0 → 11.4.5-beta.1

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.
@@ -747,6 +747,7 @@
747
747
  this.authClientSecret = '';
748
748
  this.authGrantType = '';
749
749
  this.apiUrl = '';
750
+ this.isLogoutWhileApiGetsFailed = false;
750
751
  this.loadFromMap(data);
751
752
  }
752
753
  TechlifyConfig.prototype.loadFromMap = function (data) {
@@ -757,6 +758,7 @@
757
758
  this.apiUrl = data.apiUrl;
758
759
  this.storage = data === null || data === void 0 ? void 0 : data.storage;
759
760
  this.rawConfigs = data;
761
+ this.isLogoutWhileApiGetsFailed = data === null || data === void 0 ? void 0 : data.isLogoutWhileApiGetsFailed;
760
762
  };
761
763
  return TechlifyConfig;
762
764
  }());
@@ -882,8 +884,9 @@
882
884
  * @since 20171202
883
885
  */
884
886
  var ErrorHandlerService = /** @class */ (function () {
885
- function ErrorHandlerService(alerter) {
887
+ function ErrorHandlerService(alerter, config) {
886
888
  this.alerter = alerter;
889
+ this.config = config;
887
890
  }
888
891
  ErrorHandlerService.prototype.handleError = function (errorResponse, msg) {
889
892
  if (msg === void 0) { msg = ''; }
@@ -911,17 +914,23 @@
911
914
  }
912
915
  var errMessage = errors.length ? errors[0] : msg;
913
916
  this.alerter.addAlert("Error: " + errMessage, "warning");
917
+ if (errorResponse.status == 403 && this.config.isLogoutWhileApiGetsFailed) {
918
+ sessionStorage.clear();
919
+ localStorage.clear();
920
+ location.reload();
921
+ }
914
922
  };
915
923
  return ErrorHandlerService;
916
924
  }());
917
- ErrorHandlerService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ErrorHandlerService_Factory() { return new ErrorHandlerService(i0.ɵɵinject(AlertService)); }, token: ErrorHandlerService, providedIn: "root" });
925
+ ErrorHandlerService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ErrorHandlerService_Factory() { return new ErrorHandlerService(i0.ɵɵinject(AlertService), i0.ɵɵinject(TechlifyConfig)); }, token: ErrorHandlerService, providedIn: "root" });
918
926
  ErrorHandlerService.decorators = [
919
927
  { type: i0.Injectable, args: [{
920
928
  providedIn: 'root'
921
929
  },] }
922
930
  ];
923
931
  ErrorHandlerService.ctorParameters = function () { return [
924
- { type: AlertService }
932
+ { type: AlertService },
933
+ { type: TechlifyConfig }
925
934
  ]; };
926
935
 
927
936
  var log = new Logger('ErrorHandlerInterceptor');