Commit 58a60686 authored by dev0tion's avatar dev0tion

Disable send button after send clicked

parent 9e474442
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<a><button type="button" class="btn btn-link col-12" (click)="activeModal.close('Close click')">Cancel</button></a> <a><button type="button" class="btn btn-link col-12" (click)="activeModal.close('Close click')">Cancel</button></a>
</div> </div>
<div class="modal-footer"> <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> </div>
</div> </div>
......
...@@ -26,6 +26,7 @@ export class SendComponent implements OnInit { ...@@ -26,6 +26,7 @@ export class SendComponent implements OnInit {
private errorMessage: string; private errorMessage: string;
private coinUnit: string; private coinUnit: string;
private transaction: TransactionBuilding; private transaction: TransactionBuilding;
private isSending: Boolean = false;
ngOnInit() { ngOnInit() {
this.coinUnit = this.globalService.getCoinUnit(); this.coinUnit = this.globalService.getCoinUnit();
...@@ -84,6 +85,8 @@ export class SendComponent implements OnInit { ...@@ -84,6 +85,8 @@ export class SendComponent implements OnInit {
}; };
private send() { private send() {
this.isSending = true;
this.transaction = new TransactionBuilding( this.transaction = new TransactionBuilding(
this.globalService.getWalletName(), this.globalService.getWalletName(),
this.globalService.getCoinType(), this.globalService.getCoinType(),
...@@ -101,7 +104,6 @@ export class SendComponent implements OnInit { ...@@ -101,7 +104,6 @@ export class SendComponent implements OnInit {
response => { response => {
if (response.status >= 200 && response.status < 400){ if (response.status >= 200 && response.status < 400){
this.responseMessage = response.json(); this.responseMessage = response.json();
console.log(this.responseMessage);
} }
}, },
error => { error => {
...@@ -109,6 +111,7 @@ export class SendComponent implements OnInit { ...@@ -109,6 +111,7 @@ export class SendComponent implements OnInit {
if (error.status === 0) { if (error.status === 0) {
alert("Something went wrong while connecting to the API. Please restart the application."); alert("Something went wrong while connecting to the API. Please restart the application.");
} else if (error.status >= 400) { } else if (error.status >= 400) {
this.isSending = false;
if (!error.json().errors[0]) { if (!error.json().errors[0]) {
console.log(error); console.log(error);
} }
...@@ -150,6 +153,7 @@ export class SendComponent implements OnInit { ...@@ -150,6 +153,7 @@ export class SendComponent implements OnInit {
if (error.status === 0) { if (error.status === 0) {
alert("Something went wrong while connecting to the API. Please restart the application."); alert("Something went wrong while connecting to the API. Please restart the application.");
} else if (error.status >= 400) { } else if (error.status >= 400) {
this.isSending = false;
if (!error.json().errors[0]) { if (!error.json().errors[0]) {
console.log(error); 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