mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ submitting: true, submitError: null })
|
this.setState({
|
||||||
|
submitting: true,
|
||||||
if (onSubmit) {
|
submitError: null,
|
||||||
Promise.resolve(onSubmit(txData))
|
}, () => {
|
||||||
.then(this.setState({ submitting: false }))
|
if (onSubmit) {
|
||||||
} else {
|
Promise.resolve(onSubmit(txData))
|
||||||
sendTransaction(txData)
|
.then(() => {
|
||||||
.then(() => {
|
this.setState({
|
||||||
clearConfirmTransaction()
|
submitting: false,
|
||||||
this.setState({ submitting: false })
|
})
|
||||||
history.push(DEFAULT_ROUTE)
|
})
|
||||||
})
|
} else {
|
||||||
.catch(error => {
|
sendTransaction(txData)
|
||||||
this.setState({ submitting: false, submitError: error.message })
|
.then(() => {
|
||||||
})
|
clearConfirmTransaction()
|
||||||
}
|
this.setState({
|
||||||
|
submitting: false,
|
||||||
|
}, () => {
|
||||||
|
history.push(DEFAULT_ROUTE)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.setState({
|
||||||
|
submitting: false,
|
||||||
|
submitError: error.message,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
renderTitleComponent () {
|
renderTitleComponent () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user