aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/actions.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2017-09-27 07:03:33 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-09-28 09:06:26 +0800
commit10345a12c2f812fabbcd9950da14beaa03cb2502 (patch)
treed4adcd2c507a2e4d40066f2d5f6285bbe14fb69a /ui/app/actions.js
parent01816e1b2216e0cf849ec3d67f01b1e571d69fa4 (diff)
downloadtangerine-wallet-browser-10345a12c2f812fabbcd9950da14beaa03cb2502.tar
tangerine-wallet-browser-10345a12c2f812fabbcd9950da14beaa03cb2502.tar.gz
tangerine-wallet-browser-10345a12c2f812fabbcd9950da14beaa03cb2502.tar.bz2
tangerine-wallet-browser-10345a12c2f812fabbcd9950da14beaa03cb2502.tar.lz
tangerine-wallet-browser-10345a12c2f812fabbcd9950da14beaa03cb2502.tar.xz
tangerine-wallet-browser-10345a12c2f812fabbcd9950da14beaa03cb2502.tar.zst
tangerine-wallet-browser-10345a12c2f812fabbcd9950da14beaa03cb2502.zip
Keep privateKey out of state and clear it after closing export private key modal.
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r--ui/app/actions.js39
1 files changed, 26 insertions, 13 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 63d22238b..0b860ee63 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -106,6 +106,7 @@ var actions = {
exportAccount: exportAccount,
SHOW_PRIVATE_KEY: 'SHOW_PRIVATE_KEY',
showPrivateKey: showPrivateKey,
+ exportAccountComplete,
SAVE_ACCOUNT_LABEL: 'SAVE_ACCOUNT_LABEL',
saveAccountLabel: saveAccountLabel,
// tx conf screen
@@ -984,27 +985,39 @@ function exportAccount (password, address) {
dispatch(self.showLoadingIndication())
log.debug(`background.submitPassword`)
- background.submitPassword(password, function (err) {
- if (err) {
- log.error('Error in submiting password.')
- dispatch(self.hideLoadingIndication())
- return dispatch(self.displayWarning('Incorrect Password.'))
- }
- log.debug(`background.exportAccount`)
- background.exportAccount(address, function (err, result) {
- dispatch(self.hideLoadingIndication())
-
+ return new Promise((resolve, reject) => {
+ background.submitPassword(password, function (err) {
if (err) {
- log.error(err)
- return dispatch(self.displayWarning('Had a problem exporting the account.'))
+ log.error('Error in submiting password.')
+ dispatch(self.hideLoadingIndication())
+ dispatch(self.displayWarning('Incorrect Password.'))
+ return reject(err)
}
+ log.debug(`background.exportAccount`)
+ return background.exportAccount(address, function (err, result) {
+ dispatch(self.hideLoadingIndication())
+
+ if (err) {
+ log.error(err)
+ dispatch(self.displayWarning('Had a problem exporting the account.'))
+ return reject(err)
+ }
- dispatch(self.showPrivateKey(result))
+ dispatch(self.exportAccountComplete())
+
+ return resolve(result)
+ })
})
})
}
}
+function exportAccountComplete() {
+ return {
+ type: actions.EXPORT_ACCOUNT,
+ }
+}
+
function showPrivateKey (key) {
return {
type: actions.SHOW_PRIVATE_KEY,