Error if transaction failed

This commit is contained in:
viktor 2018-02-13 16:23:41 +03:00
parent 699bf16efc
commit c3ba5ff817
1 changed files with 19 additions and 3 deletions

View File

@ -122,9 +122,25 @@ class App extends Component {
sender: initialKey
}).then(async (receipt) => {
console.log(receipt);
this.setState({loading: false})
swal("Congratulations!", "Your keys are generated!", "success");
await this.generateZip({mining, voting, payout, netIdName: this.state.web3Config.netIdName});
if (receipt.status == "0x1") {
this.setState({loading: false})
swal("Congratulations!", "Your keys are generated!", "success");
await this.generateZip({mining, voting, payout, netIdName: this.state.web3Config.netIdName});
} else {
this.setState({loading: false, keysGenerated: false})
let msg = `Transaction failed`;
content.innerHTML = `<div>
Something went wrong!<br/><br/>
Please contact Master Of Ceremony<br/><br/>
${msg}
</div>`;
swal({
icon: 'error',
title: 'Error',
content: content
});
}
}).catch((error) => {
console.error(error.message);
this.setState({loading: false, keysGenerated: false})