mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix then-catch + error handling in import-account
This commit is contained in:
parent
1c3d2aa18b
commit
0f3480a97f
@ -106,8 +106,6 @@ class JsonImportSubview extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
importNewJsonAccount([ fileContents, password ])
|
importNewJsonAccount([ fileContents, password ])
|
||||||
// JS runtime requires caught rejections but failures are handled by Redux
|
|
||||||
.catch()
|
|
||||||
.then(({ selectedAddress }) => {
|
.then(({ selectedAddress }) => {
|
||||||
if (selectedAddress) {
|
if (selectedAddress) {
|
||||||
history.push(DEFAULT_ROUTE)
|
history.push(DEFAULT_ROUTE)
|
||||||
@ -116,6 +114,7 @@ class JsonImportSubview extends Component {
|
|||||||
setSelectedAddress(firstAddress)
|
setSelectedAddress(firstAddress)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.catch(err => displayWarning(err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,8 +96,6 @@ PrivateKeyImportView.prototype.createNewKeychain = function () {
|
|||||||
const { importNewAccount, history, displayWarning, setSelectedAddress, firstAddress } = this.props
|
const { importNewAccount, history, displayWarning, setSelectedAddress, firstAddress } = this.props
|
||||||
|
|
||||||
importNewAccount('Private Key', [ privateKey ])
|
importNewAccount('Private Key', [ privateKey ])
|
||||||
// JS runtime requires caught rejections but failures are handled by Redux
|
|
||||||
.catch()
|
|
||||||
.then(({ selectedAddress }) => {
|
.then(({ selectedAddress }) => {
|
||||||
if (selectedAddress) {
|
if (selectedAddress) {
|
||||||
history.push(DEFAULT_ROUTE)
|
history.push(DEFAULT_ROUTE)
|
||||||
@ -106,4 +104,5 @@ PrivateKeyImportView.prototype.createNewKeychain = function () {
|
|||||||
setSelectedAddress(firstAddress)
|
setSelectedAddress(firstAddress)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.catch(err => displayWarning(err))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user