Commit c215c2cc authored by dev0tion's avatar dev0tion

View send modal feedback in modal

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