diff options
author | Esteban MIno <efmino@uc.cl> | 2018-08-01 01:07:28 +0800 |
---|---|---|
committer | Esteban MIno <efmino@uc.cl> | 2018-08-01 01:07:28 +0800 |
commit | ccae79d392b76d6277bbbb7c887f520e66f81a2f (patch) | |
tree | 81647694e37d5050b3acfd435e8081fcc5025d30 | |
parent | 22cf5a1391be5babae1a05bfb7b3dcde7110e286 (diff) | |
download | tangerine-wallet-browser-ccae79d392b76d6277bbbb7c887f520e66f81a2f.tar.gz tangerine-wallet-browser-ccae79d392b76d6277bbbb7c887f520e66f81a2f.tar.zst tangerine-wallet-browser-ccae79d392b76d6277bbbb7c887f520e66f81a2f.zip |
fix undefined for tokens on tests
-rw-r--r-- | app/scripts/controllers/preferences.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index 193965c2c..0cc61ba61 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -405,13 +405,15 @@ class PreferencesController { /** * Updates `accountTokens` and `tokens` of current account and network according to it. * - * @param {[array]} tokens Array of tokens to be updated. + * @param {array} tokens Array of tokens to be updated. * */ _updateAccountTokens (tokens) { const accountTokens = this.store.getState().accountTokens const selectedAddress = this.store.getState().selectedAddress const providerType = this.network.providerStore.getState().type + if (!(selectedAddress in accountTokens)) accountTokens[selectedAddress] = {} + if (!(providerType in accountTokens[selectedAddress])) accountTokens[selectedAddress][providerType] = [] accountTokens[selectedAddress][providerType] = tokens this.store.updateState({ accountTokens, tokens }) } |