aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/local_storage
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-11-23 04:21:07 +0800
committerFabio Berger <me@fabioberger.com>2017-11-23 04:21:07 +0800
commitf5e0fd8de5a3201ac17a8dde68aec3314674f1c4 (patch)
tree8001915cd933e1d5eaff1388e7dc842d602aa786 /packages/website/ts/local_storage
parent353b6f3d6df1e13ba76f86287195f7c0ce7cecc7 (diff)
downloaddexon-0x-contracts-f5e0fd8de5a3201ac17a8dde68aec3314674f1c4.tar.gz
dexon-0x-contracts-f5e0fd8de5a3201ac17a8dde68aec3314674f1c4.tar.zst
dexon-0x-contracts-f5e0fd8de5a3201ac17a8dde68aec3314674f1c4.zip
Upgrade to latest 0x.js version and refactor subscriptions to use latest interface
Diffstat (limited to 'packages/website/ts/local_storage')
-rw-r--r--packages/website/ts/local_storage/trade_history_storage.tsx14
1 files changed, 13 insertions, 1 deletions
diff --git a/packages/website/ts/local_storage/trade_history_storage.tsx b/packages/website/ts/local_storage/trade_history_storage.tsx
index 415b380b7..dd5872609 100644
--- a/packages/website/ts/local_storage/trade_history_storage.tsx
+++ b/packages/website/ts/local_storage/trade_history_storage.tsx
@@ -31,13 +31,25 @@ export const tradeHistoryStorage = {
const fillHash = this._getFillHash(fill);
const doesFillExist = !_.isUndefined(fillsByHash[fillHash]);
if (doesFillExist) {
- return;
+ return; // noop
}
fillsByHash[fillHash] = fill;
const userFillsJSONString = JSON.stringify(fillsByHash);
const userFillsKey = this._getUserFillsKey(userAddress, networkId);
localStorage.setItem(userFillsKey, userFillsJSONString);
},
+ removeFillFromUser(userAddress: string, networkId: number, fill: Fill) {
+ const fillsByHash = this.getUserFillsByHash(userAddress, networkId);
+ const fillHash = this._getFillHash(fill);
+ const doesFillExist = !_.isUndefined(fillsByHash[fillHash]);
+ if (!doesFillExist) {
+ return; // noop
+ }
+ delete fillsByHash[fillHash];
+ const userFillsJSONString = JSON.stringify(fillsByHash);
+ const userFillsKey = this._getUserFillsKey(userAddress, networkId);
+ localStorage.setItem(userFillsKey, userFillsJSONString);
+ },
getUserFillsByHash(userAddress: string, networkId: number): {[fillHash: string]: Fill} {
const userFillsKey = this._getUserFillsKey(userAddress, networkId);
const userFillsJSONString = localStorage.getItemIfExists(userFillsKey);