aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/pages/unlock-page/unlock-page.component.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/pages/unlock-page/unlock-page.component.js')
-rw-r--r--ui/app/components/pages/unlock-page/unlock-page.component.js20
1 files changed, 9 insertions, 11 deletions
diff --git a/ui/app/components/pages/unlock-page/unlock-page.component.js b/ui/app/components/pages/unlock-page/unlock-page.component.js
index a2f009d8f..8bc3897da 100644
--- a/ui/app/components/pages/unlock-page/unlock-page.component.js
+++ b/ui/app/components/pages/unlock-page/unlock-page.component.js
@@ -34,14 +34,7 @@ class UnlockPage extends Component {
}
}
- tryUnlockMetamask (password) {
- const { tryUnlockMetamask, history } = this.props
- tryUnlockMetamask(password)
- .then(() => history.push(DEFAULT_ROUTE))
- .catch(({ message }) => this.setState({ error: message }))
- }
-
- handleSubmit (event) {
+ async handleSubmit (event) {
event.preventDefault()
event.stopPropagation()
@@ -54,9 +47,14 @@ class UnlockPage extends Component {
this.setState({ error: null })
- tryUnlockMetamask(password)
- .then(() => history.push(DEFAULT_ROUTE))
- .catch(({ message }) => this.setState({ error: message }))
+ try {
+ await tryUnlockMetamask(password)
+ } catch ({ message }) {
+ this.setState({ error: message })
+ return
+ }
+
+ history.push(DEFAULT_ROUTE)
}
handleInputChange ({ target }) {