Merge pull request #89 from rstormsf/tx-status

Handle Tx status
This commit is contained in:
Victor Baranov 2018-01-23 23:53:31 +03:00 committed by GitHub
commit 1ff1a04ef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -187,11 +187,16 @@ export class NewBallot extends React.Component {
}
let curDateInSeconds = moment.utc().add(5, 'minute').unix();
methodToCreateBallot(curDateInSeconds)
.on("receipt", () => {
.on("receipt", (tx) => {
commonStore.hideLoading();
swal("Congratulations!", messages.BALLOT_CREATED_SUCCESS_MSG, "success").then((result) => {
push(`${commonStore.rootPath}`);
});
if(tx.status === '0x1'){
swal("Congratulations!", messages.BALLOT_CREATED_SUCCESS_MSG, "success").then((result) => {
push(`${commonStore.rootPath}`);
});
} else {
swal("Warning!", messages.FAILED_TX, "warning").then((result) => {
});
}
})
.on("error", (e) => {
commonStore.hideLoading();

View File

@ -26,6 +26,8 @@ messages.SHOULD_BE_MORE_THAN_TWO_DAYS = (duration, neededHours, neededMinutes) =
Please add ${neededHours} hours and ${neededMinutes} minutes in order to set correct end time
`;
}
messages.FAILED_TX = `Your transaction was failed. Please make sure you set correct parameters for ballot creation.
Make sure you don't have Transaction Error. Exception thrown in contract code message in metamask before you sign it.`
messages.DESCRIPTION_IS_EMPTY = "Description cannot be empty";
module.exports = {
messages