aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/actions.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r--ui/app/actions.js20
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 () {