monkey-front-core 0.0.197 → 0.0.200

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.
@@ -3495,6 +3495,7 @@ class MonkeyEcxAuthenticationService {
3495
3495
  this.redirectLoginWelcomeBack =
3496
3496
  args?.redirectLoginWelcomeBack || this.redirectLoginWelcomeBack.bind(this);
3497
3497
  this.isAuthorized = args?.isAuthorized || this.isAuthorized.bind(this);
3498
+ this.isTokenMandatory = args?.isTokenMandatory || this.isTokenMandatory.bind(this);
3498
3499
  this.isCompanyAuthorized = args?.isCompanyAuthorized || this.isCompanyAuthorized.bind(this);
3499
3500
  this.getRequestWithHeaders =
3500
3501
  args?.getRequestWithHeaders || this.getRequestWithHeaders.bind(this);
@@ -4682,19 +4683,28 @@ class MonkeyEcxHttpConfigHeaderInterceptor {
4682
4683
  }
4683
4684
  async handle(request, next) {
4684
4685
  const { url } = request;
4686
+ console.log('====== 1');
4685
4687
  if (this.authService.isTokenMandatory(url)) {
4688
+ console.log('====== 2');
4686
4689
  try {
4687
- const config = await this.config
4690
+ console.log('====== 3');
4691
+ const x = await this.config
4688
4692
  .config()
4689
- .pipe(take(1))
4693
+ .pipe(first((val) => {
4694
+ console.log('====== 4');
4695
+ console.log(val);
4696
+ return !!val;
4697
+ }))
4690
4698
  .toPromise();
4691
- if (!config) {
4692
- await this.onValidateConfig();
4693
- }
4699
+ console.log('====== 5');
4700
+ console.log(x);
4694
4701
  }
4695
- catch (error) {
4702
+ catch (e) {
4703
+ console.log('====== 6');
4704
+ console.log(e);
4696
4705
  // not to do
4697
4706
  }
4707
+ console.log('====== 7');
4698
4708
  }
4699
4709
  return this.authService
4700
4710
  .getRequestWithHeadersOb(request)
@@ -4711,26 +4721,6 @@ class MonkeyEcxHttpConfigHeaderInterceptor {
4711
4721
  }))
4712
4722
  .toPromise();
4713
4723
  }
4714
- onValidateConfig() {
4715
- return new Promise((resolve) => {
4716
- let count = 0;
4717
- const interval = setInterval(async () => {
4718
- count += 1;
4719
- if (count > 20) {
4720
- clearInterval(interval);
4721
- resolve(null);
4722
- }
4723
- const config = await this.config
4724
- .config()
4725
- .pipe(take(1))
4726
- .toPromise();
4727
- if (config) {
4728
- clearInterval(interval);
4729
- resolve(null);
4730
- }
4731
- }, 200);
4732
- });
4733
- }
4734
4724
  intercept(request, next) {
4735
4725
  return from(this.handle(request, next));
4736
4726
  }