aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@users.noreply.github.com>2018-05-31 00:23:31 +0800
committerGitHub <noreply@github.com>2018-05-31 00:23:31 +0800
commitd40971e7f30f86629f661a53e4c7b51f34397d87 (patch)
tree0f3e9105605c5785ad73236648b18cbf22281010 /ui
parentf5fb06020d827b76984e730be2e52463eef87170 (diff)
downloadtangerine-wallet-browser-d40971e7f30f86629f661a53e4c7b51f34397d87.tar
tangerine-wallet-browser-d40971e7f30f86629f661a53e4c7b51f34397d87.tar.gz
tangerine-wallet-browser-d40971e7f30f86629f661a53e4c7b51f34397d87.tar.bz2
tangerine-wallet-browser-d40971e7f30f86629f661a53e4c7b51f34397d87.tar.lz
tangerine-wallet-browser-d40971e7f30f86629f661a53e4c7b51f34397d87.tar.xz
tangerine-wallet-browser-d40971e7f30f86629f661a53e4c7b51f34397d87.tar.zst
tangerine-wallet-browser-d40971e7f30f86629f661a53e4c7b51f34397d87.zip
Fix error handling on incorrect password (#4401)
Diffstat (limited to 'ui')
-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 b6384b32d..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)
- .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 }) {