From d8dd34fb7dcf5c629c3b73dbbe9b109453ca2d04 Mon Sep 17 00:00:00 2001 From: Roman Storm Date: Sun, 21 Jan 2018 19:47:57 -0800 Subject: [PATCH 1/2] (Fix #86) Check tx status after submission. --- src/components/NewBallot.jsx | 13 +++++++++---- src/messages.js | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/NewBallot.jsx b/src/components/NewBallot.jsx index 51a57d7..1385363 100644 --- a/src/components/NewBallot.jsx +++ b/src/components/NewBallot.jsx @@ -188,11 +188,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(); diff --git a/src/messages.js b/src/messages.js index 15f4a95..b70cdf1 100644 --- a/src/messages.js +++ b/src/messages.js @@ -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 From a819cceefc388893ba78209430c75dd1a04d1b15 Mon Sep 17 00:00:00 2001 From: Roman Storm Date: Sun, 21 Jan 2018 19:47:57 -0800 Subject: [PATCH 2/2] (Fix #86) Check tx status after submission. --- src/components/NewBallot.jsx | 13 +++++++++---- src/messages.js | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/NewBallot.jsx b/src/components/NewBallot.jsx index 6248a31..29e6f8a 100644 --- a/src/components/NewBallot.jsx +++ b/src/components/NewBallot.jsx @@ -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(); diff --git a/src/messages.js b/src/messages.js index 2c319b5..105812f 100644 --- a/src/messages.js +++ b/src/messages.js @@ -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