Commit 2c30d23c authored by dev0tion's avatar dev0tion

Fix send component error handling

parent c1ff99ee
...@@ -97,12 +97,19 @@ export class SendComponent { ...@@ -97,12 +97,19 @@ export class SendComponent {
} }
}, },
error => { error => {
if (error.status >= 400) { console.log(error);
this.errorMessage = error; if (error.status === 0) {
console.log(this.errorMessage); alert("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 {
alert(error.json().errors[0].message);
}
} }
}, },
() => this.sendTransaction(this.responseMessage.hex) () => this.sendTransaction("123")
) )
; ;
}; };
...@@ -127,7 +134,6 @@ export class SendComponent { ...@@ -127,7 +134,6 @@ export class SendComponent {
.subscribe( .subscribe(
response => { response => {
if (response.status >= 200 && response.status < 400){ if (response.status >= 200 && response.status < 400){
console.log(response.status);
this.activeModal.close("Close clicked"); this.activeModal.close("Close clicked");
} }
}, },
...@@ -140,7 +146,7 @@ export class SendComponent { ...@@ -140,7 +146,7 @@ export class SendComponent {
console.log(error); console.log(error);
} }
else { else {
alert(error.json().errors[0].description); alert(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