diff options
author | Dan <danjm.com@gmail.com> | 2017-09-22 14:59:27 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-09-23 05:35:51 +0800 |
commit | a1d72a59fe5b03363820d6e1ac2c383ec15ccbcb (patch) | |
tree | ed00fe741c3341e9d5d56f2023283a994d1fb903 /ui/app/actions.js | |
parent | e325e5e2f5f9d09ade29bc86ec160b6da0eb6b71 (diff) | |
download | tangerine-wallet-browser-a1d72a59fe5b03363820d6e1ac2c383ec15ccbcb.tar.gz tangerine-wallet-browser-a1d72a59fe5b03363820d6e1ac2c383ec15ccbcb.tar.zst tangerine-wallet-browser-a1d72a59fe5b03363820d6e1ac2c383ec15ccbcb.zip |
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 () { |