Advertisement
Guest User

Untitled

a guest
Jul 16th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. submit() {
  2.         this.touchFormGroup(this.form);
  3.  
  4.         if (this.form.valid) {
  5.             if (this.submitLock) {
  6.                 console.log("lock");
  7.                 return;
  8.             }
  9.             this.submitLock = true;
  10.             this.changeSuccess = false;
  11.             this.changeFailure = false;
  12.             this.bankAccountService.isAccountBankCodeChangeLocked().subscribe(isLocked => {
  13.                 if (isLocked) {
  14.                     this.modalService.verifySmsCode().then(() => {
  15.                         this.form.value.Phone1 = "+" + this.form.value.Phone1Prefix + this.form.value.Phone1;
  16.                         this.userService.changePersonalData(this.form.value).subscribe(result => {
  17.                             if (result) {
  18.                                 this.changeSuccess = true;
  19.                                 ga('send', 'event', 'user', 'zapisano-dane-użytkownika', null, null, this.form.value);
  20.                                 this.load();
  21.                                 this.submitLock = false;
  22.                             } else {
  23.                                 this.changeFailure = true;
  24.                                 this.submitLock = false;
  25.                             }
  26.                         });
  27.                     }, error => {
  28.                         this.errorMessageId = error;
  29.                         this.submitLock = false;
  30.                     });
  31.                 }
  32.                 else {
  33.                     this.form.value.Phone1 = "+" + this.form.value.Phone1Prefix + this.form.value.Phone1;
  34.                     this.userService.changePersonalData(this.form.value).subscribe(result => {
  35.                         if (result) {
  36.                             this.changeSuccess = true;
  37.                             ga('send', 'event', 'user', 'zapisano-dane-użytkownika', null, null, this.form.value);
  38.                             this.load();
  39.                             this.submitLock = false;
  40.                         } else {
  41.                             this.changeFailure = true;
  42.                             this.submitLock = false;
  43.                         }
  44.                     },error => {
  45.                         this.errorMessageId = error;
  46.                         this.submitLock = false;
  47.                     });
  48.                 }
  49.             });
  50.         }
  51.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement