diff options
author | Esteban MIno <efmino@uc.cl> | 2018-07-27 07:28:12 +0800 |
---|---|---|
committer | Esteban MIno <efmino@uc.cl> | 2018-07-27 07:28:12 +0800 |
commit | 2827e13caab87692aa085af380355aeb42a13bdf (patch) | |
tree | a4be5d3e29dc98b65ee0de3f12a68b3f801927fc | |
parent | 1d3ad7cfbbdf5831f10eed774244ba1ccedf25d1 (diff) | |
download | tangerine-wallet-browser-2827e13caab87692aa085af380355aeb42a13bdf.tar.gz tangerine-wallet-browser-2827e13caab87692aa085af380355aeb42a13bdf.tar.zst tangerine-wallet-browser-2827e13caab87692aa085af380355aeb42a13bdf.zip |
add & delete tokens per network
-rw-r--r-- | app/scripts/controllers/preferences.js | 18 | ||||
-rw-r--r-- | ui/app/actions.js | 3 |
2 files changed, 10 insertions, 11 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index 6ad8a5696..7ad3ce1e3 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -204,20 +204,18 @@ class PreferencesController { * */ setSelectedAddress (_address) { - return new Promise((resolve, reject) => { - const address = normalizeAddress(_address) - const addressTokens = this.store.getState().addressTokens - const providerType = this.network.providerStore.getState().type + const address = normalizeAddress(_address) + const addressTokens = this.store.getState().addressTokens + const providerType = this.network.providerStore.getState().type - if (!(providerType in addressTokens)) addressTokens[providerType] = {} + if (!(providerType in addressTokens)) addressTokens[providerType] = {} - if (!(address in addressTokens[providerType])) addressTokens[providerType][address] = [] + if (!(address in addressTokens[providerType])) addressTokens[providerType][address] = [] - const tokens = addressTokens[providerType][address] + const tokens = addressTokens[providerType][address] - this.store.updateState({ selectedAddress: address, tokens }) - resolve() - }) + this.store.updateState({ selectedAddress: address, tokens }) + return Promise.resolve(tokens) } /** diff --git a/ui/app/actions.js b/ui/app/actions.js index 7a8d9667d..4f71d911b 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -1483,11 +1483,12 @@ function showAccountDetail (address) { return (dispatch) => { dispatch(actions.showLoadingIndication()) log.debug(`background.setSelectedAddress`) - background.setSelectedAddress(address, (err) => { + background.setSelectedAddress(address, (err, tokens) => { dispatch(actions.hideLoadingIndication()) if (err) { return dispatch(actions.displayWarning(err.message)) } + dispatch(updateTokens(tokens)) dispatch({ type: actions.SHOW_ACCOUNT_DETAIL, value: address, |