Fix private key export (#7632)

There were a few older actions that were written such that they assumed
`this` referred to the `actions` object. That assumption no longer held
as of #7561. These actions have been updated to refer directly to the
actions object instead.
feature/default_network_editable
Mark Stacey 5 years ago committed by GitHub
parent 4ec92ceed3
commit 31a4788bf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      ui/app/store/actions.js

@ -1955,7 +1955,7 @@ function editRpc (oldRpc, newRpc, chainId, ticker = 'ETH', nickname, rpcPrefs) {
background.delCustomRpc(oldRpc, (err) => { background.delCustomRpc(oldRpc, (err) => {
if (err) { if (err) {
log.error(err) log.error(err)
return dispatch(self.displayWarning('Had a problem removing network!')) return dispatch(actions.displayWarning('Had a problem removing network!'))
} }
dispatch(actions.setSelectedToken()) dispatch(actions.setSelectedToken())
background.updateAndSetCustomRpc(newRpc, chainId, ticker, nickname || newRpc, rpcPrefs, (err) => { background.updateAndSetCustomRpc(newRpc, chainId, ticker, nickname || newRpc, rpcPrefs, (err) => {
@ -1992,7 +1992,7 @@ function delRpcTarget (oldRpc) {
background.delCustomRpc(oldRpc, (err) => { background.delCustomRpc(oldRpc, (err) => {
if (err) { if (err) {
log.error(err) log.error(err)
dispatch(self.displayWarning('Had a problem removing network!')) dispatch(actions.displayWarning('Had a problem removing network!'))
return reject(err) return reject(err)
} }
dispatch(actions.setSelectedToken()) dispatch(actions.setSelectedToken())
@ -2180,32 +2180,29 @@ function requestExportAccount () {
} }
function exportAccount (password, address) { function exportAccount (password, address) {
const self = this
return function (dispatch) { return function (dispatch) {
dispatch(self.showLoadingIndication()) dispatch(actions.showLoadingIndication())
log.debug(`background.submitPassword`) log.debug(`background.submitPassword`)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
background.submitPassword(password, function (err) { background.submitPassword(password, function (err) {
if (err) { if (err) {
log.error('Error in submiting password.') log.error('Error in submiting password.')
dispatch(self.hideLoadingIndication()) dispatch(actions.hideLoadingIndication())
dispatch(self.displayWarning('Incorrect Password.')) dispatch(actions.displayWarning('Incorrect Password.'))
return reject(err) return reject(err)
} }
log.debug(`background.exportAccount`) log.debug(`background.exportAccount`)
return background.exportAccount(address, function (err, result) { return background.exportAccount(address, function (err, result) {
dispatch(self.hideLoadingIndication()) dispatch(actions.hideLoadingIndication())
if (err) { if (err) {
log.error(err) log.error(err)
dispatch(self.displayWarning('Had a problem exporting the account.')) dispatch(actions.displayWarning('Had a problem exporting the account.'))
return reject(err) return reject(err)
} }
// dispatch(self.exportAccountComplete()) dispatch(actions.showPrivateKey(result))
dispatch(self.showPrivateKey(result))
return resolve(result) return resolve(result)
}) })

Loading…
Cancel
Save