Fix state updating after vault creation and unlocking

This commit is contained in:
Dan Finlay 2016-10-20 11:00:38 -07:00
parent 2132477797
commit e5c95d68f8
3 changed files with 11 additions and 4 deletions

View File

@ -72,7 +72,7 @@ module.exports = class KeyringController extends EventEmitter {
})
.then((encryptedString) => {
this.configManager.setVault(encryptedString)
cb(null, [])
cb(null, this.getState())
})
.catch((err) => {
cb(err)
@ -82,7 +82,7 @@ module.exports = class KeyringController extends EventEmitter {
submitPassword(password, cb) {
this.loadKey(password)
.then((key) => {
cb(null, [])
cb(null, this.getState())
})
.catch((err) => {
cb(err)

View File

@ -157,11 +157,16 @@ function tryUnlockMetamask (password) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
dispatch(actions.unlockInProgress())
background.submitPassword(password, (err, selectedAccount) => {
background.submitPassword(password, (err, newState) => {
dispatch(actions.hideLoadingIndication())
if (err) {
dispatch(actions.unlockFailed())
} else {
dispatch(this.updateMetamaskState(newState))
let selectedAccount
try {
selectedAccount = newState.metamask.selectedAccount
} catch (e) {}
dispatch(actions.unlockMetamask(selectedAccount))
}
})
@ -171,10 +176,11 @@ function tryUnlockMetamask (password) {
function createNewVault (password, entropy) {
return (dispatch) => {
dispatch(actions.createNewVaultInProgress())
background.createNewVault(password, entropy, (err, result) => {
background.createNewVault(password, entropy, (err, newState) => {
if (err) {
return dispatch(actions.showWarning(err.message))
}
dispatch(this.updateMetamaskState(newState))
dispatch(this.showAccountsPage())
dispatch(this.hideLoadingIndication())
})

View File

@ -402,6 +402,7 @@ App.prototype.renderPrimary = function () {
// show initialize screen
if (!props.isInitialized || props.forgottenPassword) {
// show current view
switch (props.currentView.name) {