mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 20:02:58 +01:00
Fix usage of setState in ConfirmTransactionBase#handleSubmit (#5799)
This commit is contained in:
parent
74c18ef0e8
commit
7229f0f9fc
@ -295,22 +295,35 @@ export default class ConfirmTransactionBase extends Component {
|
||||
return
|
||||
}
|
||||
|
||||
this.setState({ submitting: true, submitError: null })
|
||||
|
||||
if (onSubmit) {
|
||||
Promise.resolve(onSubmit(txData))
|
||||
.then(this.setState({ submitting: false }))
|
||||
} else {
|
||||
sendTransaction(txData)
|
||||
.then(() => {
|
||||
clearConfirmTransaction()
|
||||
this.setState({ submitting: false })
|
||||
history.push(DEFAULT_ROUTE)
|
||||
})
|
||||
.catch(error => {
|
||||
this.setState({ submitting: false, submitError: error.message })
|
||||
})
|
||||
}
|
||||
this.setState({
|
||||
submitting: true,
|
||||
submitError: null,
|
||||
}, () => {
|
||||
if (onSubmit) {
|
||||
Promise.resolve(onSubmit(txData))
|
||||
.then(() => {
|
||||
this.setState({
|
||||
submitting: false,
|
||||
})
|
||||
})
|
||||
} else {
|
||||
sendTransaction(txData)
|
||||
.then(() => {
|
||||
clearConfirmTransaction()
|
||||
this.setState({
|
||||
submitting: false,
|
||||
}, () => {
|
||||
history.push(DEFAULT_ROUTE)
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
this.setState({
|
||||
submitting: false,
|
||||
submitError: error.message,
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
renderTitleComponent () {
|
||||
|
Loading…
Reference in New Issue
Block a user