aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/redux
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-01-29 00:45:20 +0800
committerFabio Berger <me@fabioberger.com>2018-01-29 00:45:20 +0800
commit005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1 (patch)
tree63aebaf67a71d8587e19a684c394c0ea91b48116 /packages/website/ts/redux
parent6206ebc994a2cf76b90ac426218d6ed18b74a072 (diff)
downloaddexon-sol-tools-005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1.tar
dexon-sol-tools-005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1.tar.gz
dexon-sol-tools-005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1.tar.bz2
dexon-sol-tools-005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1.tar.lz
dexon-sol-tools-005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1.tar.xz
dexon-sol-tools-005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1.tar.zst
dexon-sol-tools-005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1.zip
Fix bug where could not switch to Ledger and back
Diffstat (limited to 'packages/website/ts/redux')
-rw-r--r--packages/website/ts/redux/dispatcher.ts12
-rw-r--r--packages/website/ts/redux/reducer.ts19
2 files changed, 31 insertions, 0 deletions
diff --git a/packages/website/ts/redux/dispatcher.ts b/packages/website/ts/redux/dispatcher.ts
index dea0a8bfe..c7e0a5af3 100644
--- a/packages/website/ts/redux/dispatcher.ts
+++ b/packages/website/ts/redux/dispatcher.ts
@@ -9,6 +9,7 @@ import {
ProviderType,
ScreenWidths,
Side,
+ SideToAssetToken,
SignatureData,
Token,
TokenStateByAddress,
@@ -125,6 +126,17 @@ export class Dispatcher {
type: ActionTypes.ClearTokenByAddress,
});
}
+ public batchDispatch(tokens: Token[], networkId: number, userAddress: string, sideToAssetToken: SideToAssetToken) {
+ this._dispatch({
+ data: {
+ tokens,
+ networkId,
+ userAddress,
+ sideToAssetToken,
+ },
+ type: ActionTypes.BatchDispatch,
+ });
+ }
public updateTokenByAddress(tokens: Token[]) {
this._dispatch({
data: tokens,
diff --git a/packages/website/ts/redux/reducer.ts b/packages/website/ts/redux/reducer.ts
index cee475fa9..427a8dd4a 100644
--- a/packages/website/ts/redux/reducer.ts
+++ b/packages/website/ts/redux/reducer.ts
@@ -181,6 +181,25 @@ export function reducer(state: State = INITIAL_STATE, action: Action) {
};
}
+ case ActionTypes.BatchDispatch: {
+ const tokenByAddress = state.tokenByAddress;
+ const tokens = action.data.tokens;
+ _.each(tokens, token => {
+ const updatedToken = {
+ ...tokenByAddress[token.address],
+ ...token,
+ };
+ tokenByAddress[token.address] = updatedToken;
+ });
+ return {
+ ...state,
+ networkId: action.data.networkId,
+ userAddress: action.data.userAddress,
+ sideToAssetToken: action.data.sideToAssetToken,
+ tokenByAddress,
+ };
+ }
+
case ActionTypes.ForceTokenStateRefetch:
return {
...state,