diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-12-19 07:57:04 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-12-19 07:57:04 +0800 |
commit | 975f7279c713d88bb59205073540b2185f3a812f (patch) | |
tree | 08b5a1a0511dd46d0ef44ea3eab1275e8d550289 | |
parent | 9bb701f0633bb117bf67f13935b5e121b6b9837a (diff) | |
download | tangerine-wallet-browser-975f7279c713d88bb59205073540b2185f3a812f.tar tangerine-wallet-browser-975f7279c713d88bb59205073540b2185f3a812f.tar.gz tangerine-wallet-browser-975f7279c713d88bb59205073540b2185f3a812f.tar.bz2 tangerine-wallet-browser-975f7279c713d88bb59205073540b2185f3a812f.tar.lz tangerine-wallet-browser-975f7279c713d88bb59205073540b2185f3a812f.tar.xz tangerine-wallet-browser-975f7279c713d88bb59205073540b2185f3a812f.tar.zst tangerine-wallet-browser-975f7279c713d88bb59205073540b2185f3a812f.zip |
Allow updating token details
Fixes #2173
-rw-r--r-- | app/scripts/controllers/preferences.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index bc4848421..c42f47037 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -26,23 +26,23 @@ class PreferencesController { return this.store.getState().selectedAddress } - addToken (rawAddress, symbol, decimals) { + async addToken (rawAddress, symbol, decimals) { const address = normalizeAddress(rawAddress) const newEntry = { address, symbol, decimals } const tokens = this.store.getState().tokens - const previousIndex = tokens.find((token, index) => { + const previousEntry = tokens.find((token, index) => { return token.address === address }) + const previousIndex = tokens.indexOf(previousEntry) - if (previousIndex) { + if (previousEntry) { tokens[previousIndex] = newEntry } else { tokens.push(newEntry) } this.store.updateState({ tokens }) - return Promise.resolve() } getTokens () { |