1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

fix undefined for tokens on tests

This commit is contained in:
Esteban MIno 2018-07-31 13:07:28 -04:00
parent 22cf5a1391
commit ccae79d392

View File

@ -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 })
}