aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/preferences.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2017-10-04 01:25:52 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-10-04 06:46:01 +0800
commitac4868170f4c61d13291389d01bf1002fe240ed4 (patch)
treed4000928e6b890d99d28b8109ad82cde7bf82fce /app/scripts/controllers/preferences.js
parent45dbd017e65e5698db4580c77d723bface0e9b63 (diff)
downloadtangerine-wallet-browser-ac4868170f4c61d13291389d01bf1002fe240ed4.tar
tangerine-wallet-browser-ac4868170f4c61d13291389d01bf1002fe240ed4.tar.gz
tangerine-wallet-browser-ac4868170f4c61d13291389d01bf1002fe240ed4.tar.bz2
tangerine-wallet-browser-ac4868170f4c61d13291389d01bf1002fe240ed4.tar.lz
tangerine-wallet-browser-ac4868170f4c61d13291389d01bf1002fe240ed4.tar.xz
tangerine-wallet-browser-ac4868170f4c61d13291389d01bf1002fe240ed4.tar.zst
tangerine-wallet-browser-ac4868170f4c61d13291389d01bf1002fe240ed4.zip
Enables remove token and ensures add/remove update the list without need for refresh.
Diffstat (limited to 'app/scripts/controllers/preferences.js')
-rw-r--r--app/scripts/controllers/preferences.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js
index bc4848421..ecac40481 100644
--- a/app/scripts/controllers/preferences.js
+++ b/app/scripts/controllers/preferences.js
@@ -42,7 +42,18 @@ class PreferencesController {
}
this.store.updateState({ tokens })
- return Promise.resolve()
+ return Promise.resolve(tokens)
+ }
+
+ removeToken (rawAddress) {
+ const address = normalizeAddress(rawAddress)
+
+ const tokens = this.store.getState().tokens
+
+ const updatedTokens = tokens.filter(token => token.address !== rawAddress)
+
+ this.store.updateState({ tokens: updatedTokens })
+ return Promise.resolve(updatedTokens)
}
getTokens () {