aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-08-20 23:08:40 +0800
committerWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-08-23 02:08:09 +0800
commit743c6e7ca4a9b20a2d8e2e1909e0891a303ca92e (patch)
tree49b95da39ef332d6299f4e42712b23bec8cc3eba /ui
parent456f2faf4f1e95a618c480d373d87b0a32c97782 (diff)
downloadtangerine-wallet-browser-743c6e7ca4a9b20a2d8e2e1909e0891a303ca92e.tar
tangerine-wallet-browser-743c6e7ca4a9b20a2d8e2e1909e0891a303ca92e.tar.gz
tangerine-wallet-browser-743c6e7ca4a9b20a2d8e2e1909e0891a303ca92e.tar.bz2
tangerine-wallet-browser-743c6e7ca4a9b20a2d8e2e1909e0891a303ca92e.tar.lz
tangerine-wallet-browser-743c6e7ca4a9b20a2d8e2e1909e0891a303ca92e.tar.xz
tangerine-wallet-browser-743c6e7ca4a9b20a2d8e2e1909e0891a303ca92e.tar.zst
tangerine-wallet-browser-743c6e7ca4a9b20a2d8e2e1909e0891a303ca92e.zip
Clear warnings when exportAccount succeeds
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/modals/export-private-key-modal.js23
1 files changed, 19 insertions, 4 deletions
diff --git a/ui/app/components/modals/export-private-key-modal.js b/ui/app/components/modals/export-private-key-modal.js
index 80ece425f..163d1b15b 100644
--- a/ui/app/components/modals/export-private-key-modal.js
+++ b/ui/app/components/modals/export-private-key-modal.js
@@ -1,3 +1,4 @@
+const log = require('loglevel')
const Component = require('react').Component
const PropTypes = require('prop-types')
const h = require('react-hyperscript')
@@ -23,7 +24,13 @@ function mapStateToProps (state) {
function mapDispatchToProps (dispatch) {
return {
- exportAccount: (password, address) => dispatch(actions.exportAccount(password, address)),
+ exportAccount: (password, address) => {
+ return dispatch(actions.exportAccount(password, address))
+ .then((res) => {
+ dispatch(actions.hideWarning())
+ return res
+ })
+ },
showAccountDetailModal: () => dispatch(actions.showModal({ name: 'ACCOUNT_DETAILS' })),
hideModal: () => dispatch(actions.hideModal()),
}
@@ -36,6 +43,7 @@ function ExportPrivateKeyModal () {
this.state = {
password: '',
privateKey: null,
+ showWarning: true,
}
}
@@ -50,7 +58,11 @@ ExportPrivateKeyModal.prototype.exportAccountAndGetPrivateKey = function (passwo
const { exportAccount } = this.props
exportAccount(password, address)
- .then(privateKey => this.setState({ privateKey }))
+ .then(privateKey => this.setState({
+ privateKey,
+ showWarning: false,
+ }))
+ .catch((e) => log.error(e))
}
ExportPrivateKeyModal.prototype.renderPasswordLabel = function (privateKey) {
@@ -110,7 +122,10 @@ ExportPrivateKeyModal.prototype.render = function () {
} = this.props
const { name, address } = selectedIdentity
- const { privateKey } = this.state
+ const {
+ privateKey,
+ showWarning,
+ } = this.state
return h(AccountModalContainer, {
showBackButton: previousModalState === 'ACCOUNT_DETAILS',
@@ -134,7 +149,7 @@ ExportPrivateKeyModal.prototype.render = function () {
this.renderPasswordInput(privateKey),
- !warning ? null : h('span.private-key-password-error', warning),
+ showWarning && warning ? h('span.private-key-password-error', warning) : null,
]),
h('div.private-key-password-warning', this.context.t('privateKeyWarning')),