mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 18:41:38 +01:00
Change disabling button as state property.
This commit is contained in:
parent
f2cfbda1c9
commit
9962a3068b
@ -27,6 +27,7 @@ function PendingTx () {
|
||||
this.state = {
|
||||
valid: true,
|
||||
txData: null,
|
||||
submitting: false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -316,7 +317,7 @@ PendingTx.prototype.render = function () {
|
||||
type: 'submit',
|
||||
value: 'ACCEPT',
|
||||
style: { marginLeft: '10px' },
|
||||
disabled: insufficientBalance || !this.state.valid || !isValidAddress,
|
||||
disabled: insufficientBalance || !this.state.valid || !isValidAddress || this.state.submitting,
|
||||
}),
|
||||
|
||||
h('button.cancel.btn-red', {
|
||||
@ -410,16 +411,14 @@ PendingTx.prototype.resetGasFields = function () {
|
||||
|
||||
PendingTx.prototype.onSubmit = function (event) {
|
||||
event.preventDefault()
|
||||
const acceptButton = document.querySelector('input.confirm')
|
||||
acceptButton.disabled = true
|
||||
const txMeta = this.gatherTxMeta()
|
||||
const valid = this.checkValidity()
|
||||
this.setState({ valid })
|
||||
this.setState({ valid, submitting: true })
|
||||
if (valid && this.verifyGasParams()) {
|
||||
this.props.sendTransaction(txMeta, event)
|
||||
} else {
|
||||
this.props.dispatch(actions.displayWarning('Invalid Gas Parameters'))
|
||||
acceptButton.disabled = false
|
||||
this.setState({ submitting: false })
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user