mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Use callback in placeSeedWord method.
When displaying seed words, we were not using a callback, which had some race condition potential. This is simply a little cleaner and more correct. Fixes #842
This commit is contained in:
parent
ecfda5bcc5
commit
ea56426b23
@ -173,10 +173,15 @@ module.exports = class KeyringController extends EventEmitter {
|
||||
})
|
||||
}
|
||||
|
||||
placeSeedWords () {
|
||||
placeSeedWords (cb) {
|
||||
const firstKeyring = this.keyrings[0]
|
||||
const seedWords = firstKeyring.serialize().mnemonic
|
||||
this.configManager.setSeedWords(seedWords)
|
||||
|
||||
if (cb && typeof cb === 'function') {
|
||||
cb()
|
||||
this.emit('update')
|
||||
}
|
||||
}
|
||||
|
||||
submitPassword (password, cb) {
|
||||
|
@ -221,9 +221,11 @@ function requestRevealSeed (password) {
|
||||
return (dispatch) => {
|
||||
dispatch(actions.showLoadingIndication())
|
||||
background.submitPassword(password, (err) => {
|
||||
dispatch(actions.hideLoadingIndication())
|
||||
if (err) return dispatch(actions.displayWarning(err.message))
|
||||
background.placeSeedWords()
|
||||
background.placeSeedWords((err) => {
|
||||
if (err) return dispatch(actions.displayWarning(err.message))
|
||||
dispatch(actions.hideLoadingIndication())
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user