aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/redux
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-11 05:31:19 +0800
committerFabio Berger <me@fabioberger.com>2018-03-11 05:31:19 +0800
commit63f2606863b9dc3b01fbdc52e232103d07f35c45 (patch)
treec2c8a1e295832f7c8d329258bf288331951be77b /packages/website/ts/redux
parent5160e0ba1831d4796f7a03c1e28a356edc395ae7 (diff)
downloaddexon-sol-tools-63f2606863b9dc3b01fbdc52e232103d07f35c45.tar
dexon-sol-tools-63f2606863b9dc3b01fbdc52e232103d07f35c45.tar.gz
dexon-sol-tools-63f2606863b9dc3b01fbdc52e232103d07f35c45.tar.bz2
dexon-sol-tools-63f2606863b9dc3b01fbdc52e232103d07f35c45.tar.lz
dexon-sol-tools-63f2606863b9dc3b01fbdc52e232103d07f35c45.tar.xz
dexon-sol-tools-63f2606863b9dc3b01fbdc52e232103d07f35c45.tar.zst
dexon-sol-tools-63f2606863b9dc3b01fbdc52e232103d07f35c45.zip
Refactor blockchain to store userAddress as address or undefined
Diffstat (limited to 'packages/website/ts/redux')
-rw-r--r--packages/website/ts/redux/dispatcher.ts6
-rw-r--r--packages/website/ts/redux/reducer.ts4
2 files changed, 5 insertions, 5 deletions
diff --git a/packages/website/ts/redux/dispatcher.ts b/packages/website/ts/redux/dispatcher.ts
index e40d435e0..13e9a10cc 100644
--- a/packages/website/ts/redux/dispatcher.ts
+++ b/packages/website/ts/redux/dispatcher.ts
@@ -86,7 +86,7 @@ export class Dispatcher {
type: ActionTypes.UpdateOrderTakerAddress,
});
}
- public updateUserAddress(address: string) {
+ public updateUserAddress(address?: string) {
this._dispatch({
data: address,
type: ActionTypes.UpdateUserAddress,
@@ -125,14 +125,14 @@ export class Dispatcher {
public batchDispatch(
tokenByAddress: TokenByAddress,
networkId: number,
- userAddress: string,
+ userAddressIfExists: string | undefined,
sideToAssetToken: SideToAssetToken,
) {
this._dispatch({
data: {
tokenByAddress,
networkId,
- userAddress,
+ userAddressIfExists,
sideToAssetToken,
},
type: ActionTypes.BatchDispatch,
diff --git a/packages/website/ts/redux/reducer.ts b/packages/website/ts/redux/reducer.ts
index 1d43e4ffb..2f3150f92 100644
--- a/packages/website/ts/redux/reducer.ts
+++ b/packages/website/ts/redux/reducer.ts
@@ -187,7 +187,7 @@ export function reducer(state: State = INITIAL_STATE, action: Action) {
return {
...state,
networkId: action.data.networkId,
- userAddress: action.data.userAddress,
+ userAddress: _.isUndefined(action.data.userAddress) ? '' : action.data.userAddress,
sideToAssetToken: action.data.sideToAssetToken,
tokenByAddress: action.data.tokenByAddress,
};
@@ -286,7 +286,7 @@ export function reducer(state: State = INITIAL_STATE, action: Action) {
case ActionTypes.UpdateUserAddress: {
return {
...state,
- userAddress: action.data,
+ userAddress: _.isUndefined(action.data) ? '' : action.data,
};
}