(Fix #86) Check tx status after submission.

This commit is contained in:
Roman Storm 2018-01-21 19:47:57 -08:00
parent 61a11a78ea
commit a819cceefc
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