Browse Source

Clean import accounts

master
Loëck Vézien 7 years ago
parent
commit
4e2f72ff1c
No known key found for this signature in database GPG Key ID: CBCDCE384E853AC4
  1. 13
      src/components/modals/AddAccount/index.js
  2. 2
      src/internals/usb/wallet/accounts.js
  3. 1
      src/internals/usb/wallet/index.js

13
src/components/modals/AddAccount/index.js

@ -134,6 +134,19 @@ class AddAccountModal extends PureComponent<Props, State> {
ipcRenderer.on('msg', this.handleWalletRequest)
}
componentWillReceiveProps(nextProps) {
if (nextProps.accounts) {
this.setState(prev => ({
accounts: Object.keys(prev.accounts).reduce((result, value) => {
if (!nextProps.accounts[value]) {
result[value] = prev.accounts[value]
}
return result
}, {}),
}))
}
}
componentDidUpdate() {
const { step } = this.state
const { currentDevice } = this.props

2
src/internals/usb/wallet/accounts.js

@ -122,7 +122,7 @@ export default async ({
const hasTransactions = account.transactions.length > 0
accounts[currentAccount] = {
accounts[xpub58] = {
id: xpub58,
...account,
}

1
src/internals/usb/wallet/index.js

@ -31,6 +31,7 @@ export default (sendEvent: Function) => ({
currentAccounts,
onProgress: progress => sendEvent('wallet.getAccounts.progress', progress, { kill: false }),
})
sendEvent('wallet.getAccounts.success', data)
} catch (err) {
sendEvent('wallet.getAccounts.fail', err.stack || err)

Loading…
Cancel
Save