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

Fix error handling on incorrect password (#4401)

This commit is contained in:
Alexander Tseung 2018-05-30 09:23:31 -07:00 committed by GitHub
parent f5fb06020d
commit d40971e7f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,14 +34,7 @@ class UnlockPage extends Component {
}
}
tryUnlockMetamask (password) {
const { tryUnlockMetamask, history } = this.props
tryUnlockMetamask(password)
.catch(({ message }) => this.setState({ error: message }))
.then(() => history.push(DEFAULT_ROUTE))
}
handleSubmit (event) {
async handleSubmit (event) {
event.preventDefault()
event.stopPropagation()
@ -54,9 +47,14 @@ class UnlockPage extends Component {
this.setState({ error: null })
tryUnlockMetamask(password)
.catch(({ message }) => this.setState({ error: message }))
.then(() => history.push(DEFAULT_ROUTE))
try {
await tryUnlockMetamask(password)
} catch ({ message }) {
this.setState({ error: message })
return
}
history.push(DEFAULT_ROUTE)
}
handleInputChange ({ target }) {