aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorJacky Chan <jchan@uber.com>2017-08-29 15:52:59 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-10-21 12:51:37 +0800
commit449bce5eea5a5ee049828121876340ae226351b7 (patch)
tree515443b226678d61b1a8c466ec814e358c26d107 /ui
parent1a9b217558fd7a3a528a068c6820f2d905d62e9d (diff)
downloadtangerine-wallet-browser-449bce5eea5a5ee049828121876340ae226351b7.tar
tangerine-wallet-browser-449bce5eea5a5ee049828121876340ae226351b7.tar.gz
tangerine-wallet-browser-449bce5eea5a5ee049828121876340ae226351b7.tar.bz2
tangerine-wallet-browser-449bce5eea5a5ee049828121876340ae226351b7.tar.lz
tangerine-wallet-browser-449bce5eea5a5ee049828121876340ae226351b7.tar.xz
tangerine-wallet-browser-449bce5eea5a5ee049828121876340ae226351b7.tar.zst
tangerine-wallet-browser-449bce5eea5a5ee049828121876340ae226351b7.zip
Implement Import Account Screen
Diffstat (limited to 'ui')
-rw-r--r--ui/app/actions.js27
1 files changed, 17 insertions, 10 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index ec18f099e..04bba6bf2 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -310,18 +310,25 @@ function importNewAccount (strategy, args) {
return (dispatch) => {
dispatch(actions.showLoadingIndication('This may take a while, be patient.'))
log.debug(`background.importAccountWithStrategy`)
- background.importAccountWithStrategy(strategy, args, (err) => {
- if (err) return dispatch(actions.displayWarning(err.message))
- log.debug(`background.getState`)
- background.getState((err, newState) => {
- dispatch(actions.hideLoadingIndication())
+ return new Promise((resolve, reject) => {
+ background.importAccountWithStrategy(strategy, args, (err) => {
if (err) {
- return dispatch(actions.displayWarning(err.message))
+ dispatch(actions.displayWarning(err.message))
+ return reject(err)
}
- dispatch(actions.updateMetamaskState(newState))
- dispatch({
- type: actions.SHOW_ACCOUNT_DETAIL,
- value: newState.selectedAddress,
+ log.debug(`background.getState`)
+ background.getState((err, newState) => {
+ dispatch(actions.hideLoadingIndication())
+ if (err) {
+ dispatch(actions.displayWarning(err.message))
+ return reject(err)
+ }
+ dispatch(actions.updateMetamaskState(newState))
+ dispatch({
+ type: actions.SHOW_ACCOUNT_DETAIL,
+ value: newState.selectedAddress,
+ })
+ resolve(newState)
})
})
})