Commit 58a60686 authored by dev0tion's avatar dev0tion

Disable send button after send clicked

parent 9e474442
......@@ -54,7 +54,7 @@
<a><button type="button" class="btn btn-link col-12" (click)="activeModal.close('Close click')">Cancel</button></a>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-lg btn-primary" [disabled]="!sendForm.valid" (click)="send()">Send</button>
<button type="submit" class="btn btn-lg btn-primary" [disabled]="!sendForm.valid || isSending" (click)="send()">Send</button>
</div>
</div>
</div>
......
......@@ -26,6 +26,7 @@ export class SendComponent implements OnInit {
private errorMessage: string;
private coinUnit: string;
private transaction: TransactionBuilding;
private isSending: Boolean = false;
ngOnInit() {
this.coinUnit = this.globalService.getCoinUnit();
......@@ -84,6 +85,8 @@ export class SendComponent implements OnInit {
};
private send() {
this.isSending = true;
this.transaction = new TransactionBuilding(
this.globalService.getWalletName(),
this.globalService.getCoinType(),
......@@ -101,7 +104,6 @@ export class SendComponent implements OnInit {
response => {
if (response.status >= 200 && response.status < 400){
this.responseMessage = response.json();
console.log(this.responseMessage);
}
},
error => {
......@@ -109,6 +111,7 @@ export class SendComponent implements OnInit {
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,6 +153,7 @@ export class SendComponent implements OnInit {
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