1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Checks if there is currently a send in progress before redirecting to default in conf-tx

This commit is contained in:
Dan 2017-12-07 01:18:41 -03:30 committed by Alexander Tseung
parent 4f1fe1da62
commit f38675c9ac

View File

@ -44,6 +44,7 @@ function mapStateToProps (state) {
computedBalances: state.metamask.computedBalances, computedBalances: state.metamask.computedBalances,
unapprovedMsgCount, unapprovedMsgCount,
unapprovedPersonalMsgCount, unapprovedPersonalMsgCount,
send: state.metamask.send,
} }
} }
@ -53,15 +54,18 @@ function ConfirmTxScreen () {
} }
ConfirmTxScreen.prototype.componentWillMount = function () { ConfirmTxScreen.prototype.componentWillMount = function () {
const { unapprovedTxs = {} } = this.props const { unapprovedTxs = {}, send } = this.props
if (Object.keys(unapprovedTxs).length === 0) { const { to } = send
if (Object.keys(unapprovedTxs).length === 0 && !to) {
this.props.history.push(DEFAULT_ROUTE) this.props.history.push(DEFAULT_ROUTE)
} }
} }
ConfirmTxScreen.prototype.componentWillReceiveProps = function (nextProps) { ConfirmTxScreen.prototype.componentWillReceiveProps = function (nextProps) {
const { send } = this.props
const { to } = send
const { unapprovedTxs = {} } = nextProps const { unapprovedTxs = {} } = nextProps
if (Object.keys(unapprovedTxs).length === 0) { if (Object.keys(unapprovedTxs).length === 0 && !to) {
this.props.history.push(DEFAULT_ROUTE) this.props.history.push(DEFAULT_ROUTE)
} }
} }