Commit c215c2cc authored by dev0tion's avatar dev0tion

View send modal feedback in modal

parent 1ddc0f62
......@@ -47,6 +47,7 @@
<input type="password" class="form-control form-control-success" formControlName="password" id="walletPassword" placeholder="Please enter your wallet password.">
<div *ngIf="formErrors.password" class="form-control-feedback">{{formErrors.password}}</div>
</div>
<div *ngIf="apiError" class="text-danger mt-2">{{ apiError }}</div>
</form>
<!-- /form-->
</div>
......
......@@ -28,6 +28,7 @@ export class SendComponent implements OnInit {
public coinUnit: string;
public isSending: boolean = false;
public estimatedFee: number;
public apiError: string;
private transactionHex: string;
private responseMessage: any;
private errorMessage: string;
......@@ -66,6 +67,8 @@ export class SendComponent implements OnInit {
}
}
this.apiError = "";
if(this.sendForm.get("address").valid && this.sendForm.get("amount").valid) {
this.estimateFee();
}
......@@ -115,13 +118,15 @@ export class SendComponent implements OnInit {
error => {
console.log(error);
if (error.status === 0) {
this.genericModalService.openModal(null, null);
//this.genericModalService.openModal(null, null);
this.apiError = "Something went wrong while connecting to the API. Please restart the application."
} else if (error.status >= 400) {
if (!error.json().errors[0]) {
console.log(error);
}
else {
this.genericModalService.openModal(null, error.json().errors[0].message);
//this.genericModalService.openModal(null, error.json().errors[0].message);
this.apiError = error.json().errors[0].message;
}
}
},
......@@ -158,7 +163,8 @@ export class SendComponent implements OnInit {
console.log(error);
}
else {
this.genericModalService.openModal(null, error.json().errors[0].message);
//this.genericModalService.openModal(null, error.json().errors[0].message);
this.apiError = error.json().errors[0].message;
}
}
},
......@@ -195,13 +201,15 @@ export class SendComponent implements OnInit {
console.log(error);
this.isSending = false;
if (error.status === 0) {
this.genericModalService.openModal(null, null);
//this.genericModalService.openModal(null, null);
this.apiError = "Something went wrong while connecting to the API. Please restart the application."
} else if (error.status >= 400) {
if (!error.json().errors[0]) {
console.log(error);
}
else {
this.genericModalService.openModal(null, error.json().errors[0].message);
//this.genericModalService.openModal(null, error.json().errors[0].message);
this.apiError = error.json().errors[0].message;
}
}
},
......@@ -235,13 +243,15 @@ export class SendComponent implements OnInit {
console.log(error);
this.isSending = false;
if (error.status === 0) {
this.genericModalService.openModal(null, null);
//this.genericModalService.openModal(null, null);
this.apiError = "Something went wrong while connecting to the API. Please restart the application."
} else if (error.status >= 400) {
if (!error.json().errors[0]) {
console.log(error);
}
else {
this.genericModalService.openModal(null, error.json().errors[0].message);
//this.genericModalService.openModal(null, error.json().errors[0].message);
this.apiError = error.json().errors[0].message;
}
}
},
......
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