diff options
author | Andrew Maurer <git@maurer.me> | 2018-10-13 23:09:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-13 23:09:50 +0800 |
commit | 69e9dbd68323439ac817e71c610dfae3716bee26 (patch) | |
tree | 6b2791f09132524963ae5e0bb58afffcb3720736 /packages/instant/src/redux/reducer.ts | |
parent | dc56ce454967d2bf0d5e8c93389c0fa71a9d1cc5 (diff) | |
parent | a424c2adfabbbd9313b4f5ddeeeaebd0811fd1cd (diff) | |
download | dexon-sol-tools-69e9dbd68323439ac817e71c610dfae3716bee26.tar dexon-sol-tools-69e9dbd68323439ac817e71c610dfae3716bee26.tar.gz dexon-sol-tools-69e9dbd68323439ac817e71c610dfae3716bee26.tar.bz2 dexon-sol-tools-69e9dbd68323439ac817e71c610dfae3716bee26.tar.lz dexon-sol-tools-69e9dbd68323439ac817e71c610dfae3716bee26.tar.xz dexon-sol-tools-69e9dbd68323439ac817e71c610dfae3716bee26.tar.zst dexon-sol-tools-69e9dbd68323439ac817e71c610dfae3716bee26.zip |
Merge branch 'development' into development
Diffstat (limited to 'packages/instant/src/redux/reducer.ts')
-rw-r--r-- | packages/instant/src/redux/reducer.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/packages/instant/src/redux/reducer.ts b/packages/instant/src/redux/reducer.ts new file mode 100644 index 000000000..5026895ae --- /dev/null +++ b/packages/instant/src/redux/reducer.ts @@ -0,0 +1,31 @@ +import { BigNumber } from '@0xproject/utils'; +import * as _ from 'lodash'; + +import { Action, ActionTypes } from '../types'; + +export interface State { + ethUsdPrice?: string; + selectedAssetAmount?: BigNumber; +} + +export const INITIAL_STATE: State = { + ethUsdPrice: undefined, + selectedAssetAmount: undefined, +}; + +export const reducer = (state: State = INITIAL_STATE, action: Action): State => { + switch (action.type) { + case ActionTypes.UPDATE_ETH_USD_PRICE: + return { + ...state, + ethUsdPrice: action.data, + }; + case ActionTypes.UPDATE_SELECTED_ASSET_AMOUNT: + return { + ...state, + selectedAssetAmount: action.data, + }; + default: + return state; + } +}; |