diff options
-rw-r--r-- | ui/app/actions.js | 9 | ||||
-rw-r--r-- | ui/app/components/send/send-v2-container.js | 1 | ||||
-rw-r--r-- | ui/app/reducers/metamask.js | 18 | ||||
-rw-r--r-- | ui/app/send-v2.js | 10 |
4 files changed, 31 insertions, 7 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 4c83f95b4..169fac78a 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -143,6 +143,7 @@ var actions = { UPDATE_SEND_AMOUNT: 'UPDATE_SEND_AMOUNT', UPDATE_SEND_MEMO: 'UPDATE_SEND_MEMO', UPDATE_SEND_ERRORS: 'UPDATE_SEND_ERRORS', + CLEAR_SEND: 'CLEAR_SEND', updateGasLimit, updateGasPrice, updateGasTotal, @@ -151,6 +152,7 @@ var actions = { updateSendAmount, updateSendMemo, updateSendErrors, + clearSend, setSelectedAddress, // app messages confirmSeedWords: confirmSeedWords, @@ -577,13 +579,18 @@ function updateSendMemo (memo) { } function updateSendErrors (error) { - console.log(`updateSendErrors error`, error); return { type: actions.UPDATE_SEND_ERRORS, value: error, } } +function clearSend () { + return { + type: actions.CLEAR_SEND + } +} + function sendTx (txData) { log.info(`actions - sendTx: ${JSON.stringify(txData.txParams)}`) diff --git a/ui/app/components/send/send-v2-container.js b/ui/app/components/send/send-v2-container.js index c14865e9f..80b52a3ab 100644 --- a/ui/app/components/send/send-v2-container.js +++ b/ui/app/components/send/send-v2-container.js @@ -80,5 +80,6 @@ function mapDispatchToProps (dispatch) { updateSendMemo: newMemo => dispatch(actions.updateSendMemo(newMemo)), updateSendErrors: newError => dispatch(actions.updateSendErrors(newError)), goHome: () => dispatch(actions.goHome()), + clearSend: () => dispatch(actions.clearSend()) } } diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js index fb2b2e674..8bf003e64 100644 --- a/ui/app/reducers/metamask.js +++ b/ui/app/reducers/metamask.js @@ -226,10 +226,6 @@ function reduceMetamask (state, action) { }) case actions.UPDATE_SEND_ERRORS: - console.log(123, { - ...metamaskState.send.errors, - ...action.value, - }) return extend(metamaskState, { send: { ...metamaskState.send, @@ -240,6 +236,20 @@ function reduceMetamask (state, action) { }, }) + case actions.CLEAR_SEND: + return extend(metamaskState, { + send: { + gasLimit: null, + gasPrice: null, + gasTotal: null, + from: '', + to: '', + amount: '0x0', + memo: '', + errors: {}, + }, + }) + default: return metamaskState diff --git a/ui/app/send-v2.js b/ui/app/send-v2.js index 5e64daceb..a9473541c 100644 --- a/ui/app/send-v2.js +++ b/ui/app/send-v2.js @@ -382,11 +382,14 @@ SendTransactionScreen.prototype.renderForm = function () { } SendTransactionScreen.prototype.renderFooter = function () { - const { goHome } = this.props + const { goHome, clearSend } = this.props return h('div.send-v2__footer', [ h('button.send-v2__cancel-btn', { - onClick: goHome, + onClick: () => { + clearSend() + goHome() + }, }, 'Cancel'), h('button.send-v2__next-btn', { onClick: event => this.onSubmit(event), @@ -429,6 +432,7 @@ SendTransactionScreen.prototype.onSubmit = function (event) { signTx, selectedToken, toAccounts, + clearSend, } = this.props this.addToAddressBookIfNew(to) @@ -445,6 +449,8 @@ SendTransactionScreen.prototype.onSubmit = function (event) { txParams.to = to } + clearSend() + selectedToken ? signTokenTx(selectedToken.address, to, amount, txParams) : signTx(txParams) |