Commit 5d2e3ac1 authored by dev0tion's avatar dev0tion

Disable decrypt, create and recover button on api call

parent 58a60686
......@@ -20,6 +20,7 @@ export class LoginComponent implements OnInit {
private openWalletForm: FormGroup;
private hasWallet: boolean = false;
private wallets: [string];
private isDecrypting = false;
ngOnInit() {
this.getWalletFiles();
......@@ -112,6 +113,7 @@ export class LoginComponent implements OnInit {
}
private onDecryptClicked() {
this.isDecrypting = true;
this.globalService.setWalletName(this.openWalletForm.get("selectWallet").value);
let walletLoad = new WalletLoad(
this.openWalletForm.get("selectWallet").value,
......@@ -133,6 +135,7 @@ export class LoginComponent implements OnInit {
}
},
error => {
this.isDecrypting = false;
if (error.status === 0) {
alert("Something went wrong while connecting to the API. Please restart the application.");
} else if (error.status >= 400) {
......@@ -159,6 +162,7 @@ export class LoginComponent implements OnInit {
}
},
error => {
this.isDecrypting = false;
if (error.status === 0) {
alert("Something went wrong while connecting to the API. Please restart the application.");
} else if (error.status >= 400) {
......
......@@ -34,7 +34,7 @@
</div>
<!-- /row-->
<div class="row d-flex justify-content-center">
<button type="button" class="btn btn-darkgray btn-lg" [disabled]="!createWalletForm.valid" (click)="onCreateClicked()">Create</button>
<button type="button" class="btn btn-darkgray btn-lg" [disabled]="!createWalletForm.valid || isCreating" (click)="onCreateClicked()">Create</button>
</div>
<!-- /row-->
</div>
......
......@@ -24,6 +24,7 @@ export class CreateComponent implements OnInit {
private createWalletForm: FormGroup;
private newWallet: WalletCreation;
private mnemonic: string;
private isCreating: Boolean = false;
ngOnInit() {
this.getNewMnemonic();
......@@ -99,6 +100,7 @@ export class CreateComponent implements OnInit {
}
private onCreateClicked() {
this.isCreating = true;
if (this.mnemonic) {
this.newWallet = new WalletCreation(
this.createWalletForm.get("walletName").value,
......@@ -147,6 +149,7 @@ export class CreateComponent implements OnInit {
},
error => {
console.log(error);
this.isCreating = false;
if (error.status === 0) {
alert("Something went wrong while connecting to the API. Please restart the application.");
} else if (error.status >= 400) {
......@@ -174,6 +177,7 @@ export class CreateComponent implements OnInit {
}
},
error => {
this.isCreating = false;
console.log(error);
if (error.status === 0) {
alert("Something went wrong while connecting to the API. Please restart the application.");
......
......@@ -37,7 +37,7 @@
</div>
<!-- /row-->
<div class="row d-flex justify-content-center">
<button type="button" class="btn btn-darkgray btn-lg" [disabled]="!recoverWalletForm.valid" (click)="onRecoverClicked()">Recover</button>
<button type="button" class="btn btn-darkgray btn-lg" [disabled]="!recoverWalletForm.valid || isRecovering" (click)="onRecoverClicked()">Recover</button>
</div>
<!-- /row-->
</div>
......
......@@ -22,6 +22,7 @@ export class RecoverComponent implements OnInit {
private recoverWalletForm: FormGroup;
private creationDate: Date;
private walletRecovery: WalletRecovery;
private isRecovering: Boolean = false;
private responseMessage: string;
private errorMessage: string;
......@@ -90,6 +91,7 @@ export class RecoverComponent implements OnInit {
}
private onRecoverClicked(){
this.isRecovering = true;
this.walletRecovery = new WalletRecovery(
this.recoverWalletForm.get("walletName").value,
this.recoverWalletForm.get("walletMnemonic").value,
......@@ -110,6 +112,7 @@ export class RecoverComponent implements OnInit {
}
},
error => {
this.isRecovering = false;
console.log(error);
if (error.status === 0) {
alert("Something went wrong while connecting to the API. Please restart the application.");
......@@ -139,6 +142,7 @@ export class RecoverComponent implements OnInit {
}
},
error => {
this.isRecovering = false;
console.log(error);
if (error.status === 0) {
alert("Something went wrong while connecting to the API. Please restart the application.");
......
......@@ -108,10 +108,10 @@ export class SendComponent implements OnInit {
},
error => {
console.log(error);
this.isSending = false;
if (error.status === 0) {
alert("Something went wrong while connecting to the API. Please restart the application.");
} else if (error.status >= 400) {
this.isSending = false;
if (!error.json().errors[0]) {
console.log(error);
}
......@@ -150,10 +150,10 @@ export class SendComponent implements OnInit {
},
error => {
console.log(error);
this.isSending = false;
if (error.status === 0) {
alert("Something went wrong while connecting to the API. Please restart the application.");
} else if (error.status >= 400) {
this.isSending = false;
if (!error.json().errors[0]) {
console.log(error);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment