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:
parent
22cf5a1391
commit
ccae79d392
@ -405,13 +405,15 @@ class PreferencesController {
|
|||||||
/**
|
/**
|
||||||
* Updates `accountTokens` and `tokens` of current account and network according to it.
|
* 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) {
|
_updateAccountTokens (tokens) {
|
||||||
const accountTokens = this.store.getState().accountTokens
|
const accountTokens = this.store.getState().accountTokens
|
||||||
const selectedAddress = this.store.getState().selectedAddress
|
const selectedAddress = this.store.getState().selectedAddress
|
||||||
const providerType = this.network.providerStore.getState().type
|
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
|
accountTokens[selectedAddress][providerType] = tokens
|
||||||
this.store.updateState({ accountTokens, tokens })
|
this.store.updateState({ accountTokens, tokens })
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user