diff options
New account modal now allows for addition of account name.
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r-- | ui/app/actions.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 1231fc296..a6730db7f 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -349,9 +349,25 @@ function navigateToNewAccountScreen () { } } -function addNewAccount () { +function addNewAccount (oldIdentities) { log.debug(`background.addNewAccount`) - return callBackgroundThenUpdate(background.addNewAccount) + return (dispatch) => { + dispatch(actions.showLoadingIndication()) + return new Promise((resolve, reject) => { + background.addNewAccount((err, { identities: newIdentities}) => { + if (err) { + dispatch(actions.displayWarning(err.message)) + return reject(err) + } + const newAccountAddress = Object.keys(newIdentities).find(address => !oldIdentities[address]) + + dispatch(actions.hideLoadingIndication()) + + forceUpdateMetamaskState(dispatch) + return resolve(newAccountAddress) + }) + }); + } } function showInfoPage () { |