tango-app-ui-auth 3.5.0-beta.13 → 3.5.0-beta.14-test

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.
@@ -336,7 +336,6 @@ class TangoAuthLoginComponent {
336
336
  }
337
337
  loginAttemptCount = 0;
338
338
  showBanner = false;
339
- loginResponse;
340
339
  onLogin(resend) {
341
340
  // localStorage.clear();
342
341
  this.hasError = false;
@@ -387,11 +386,17 @@ class TangoAuthLoginComponent {
387
386
  // this.authlocalStorageToken,
388
387
  // JSON.stringify(res?.data?.result)
389
388
  // );
390
- this.loginResponse = res?.data?.result;
389
+ let loginToken = this.service.getCookie(this.authlocalStorageToken);
390
+ if (loginToken) {
391
+ loginToken = JSON.parse(loginToken);
392
+ }
393
+ // STEP 2: Store new token in cookie
394
+ this.service.setCookie(this.authlocalStorageToken, JSON.stringify(res?.data?.result), 1);
391
395
  if (!res?.data.termsAndCondition) {
392
396
  this.showTermsAndConditions();
393
397
  const consent = this.service.getCookie('cookieConsent');
394
398
  this.showBanner = !consent;
399
+ return;
395
400
  }
396
401
  else {
397
402
  this.userProfile();
@@ -433,12 +438,6 @@ class TangoAuthLoginComponent {
433
438
  }
434
439
  }
435
440
  userProfile() {
436
- let loginToken = this.service.getCookie(this.authlocalStorageToken);
437
- if (loginToken) {
438
- loginToken = JSON.parse(loginToken);
439
- }
440
- // STEP 2: Store new token in cookie
441
- this.service.setCookie(this.authlocalStorageToken, JSON.stringify(this.loginResponse), 1);
442
441
  this.service.userProfileDet().pipe(takeUntil(this.destroy$)).subscribe({
443
442
  next: (res) => {
444
443
  if (res && res.code == 200) {
@@ -497,10 +496,7 @@ class TangoAuthLoginComponent {
497
496
  else {
498
497
  // this.onLogin(true);
499
498
  }
500
- }).catch((err) => {
501
- this.hasError = true;
502
- this.toastService.getErrorToast(err.error.error);
503
- localStorage.clear();
499
+ }).catch(() => {
504
500
  });
505
501
  }
506
502
  acceptCookies() {