aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/redux
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-18 04:26:18 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-18 05:44:40 +0800
commit187bbc7fc14ccc0385981a38602334de65e2506c (patch)
tree79e2ad1cdd6a922c0cd5563dd4445317f8534bbd /packages/instant/src/redux
parentd46b28873385a8d6521d36f2a529451e1f725b26 (diff)
downloaddexon-sol-tools-187bbc7fc14ccc0385981a38602334de65e2506c.tar
dexon-sol-tools-187bbc7fc14ccc0385981a38602334de65e2506c.tar.gz
dexon-sol-tools-187bbc7fc14ccc0385981a38602334de65e2506c.tar.bz2
dexon-sol-tools-187bbc7fc14ccc0385981a38602334de65e2506c.tar.lz
dexon-sol-tools-187bbc7fc14ccc0385981a38602334de65e2506c.tar.xz
dexon-sol-tools-187bbc7fc14ccc0385981a38602334de65e2506c.tar.zst
dexon-sol-tools-187bbc7fc14ccc0385981a38602334de65e2506c.zip
latestErrorDismissed -> latestErrorDisplay enum
Diffstat (limited to 'packages/instant/src/redux')
-rw-r--r--packages/instant/src/redux/reducer.ts25
1 files changed, 11 insertions, 14 deletions
diff --git a/packages/instant/src/redux/reducer.ts b/packages/instant/src/redux/reducer.ts
index 4ff49c225..d23064db7 100644
--- a/packages/instant/src/redux/reducer.ts
+++ b/packages/instant/src/redux/reducer.ts
@@ -7,22 +7,19 @@ import { AsyncProcessState } from '../types';
import { Action, ActionTypes } from './actions';
-interface BaseState {
+export enum LatestErrorDisplay {
+ Present,
+ Hidden,
+}
+export interface State {
selectedAssetData?: string;
selectedAssetAmount?: BigNumber;
selectedAssetBuyState: AsyncProcessState;
ethUsdPrice?: BigNumber;
latestBuyQuote?: BuyQuote;
+ latestError?: any;
+ latestErrorDisplay: LatestErrorDisplay;
}
-interface StateWithError extends BaseState {
- latestError: any;
- latestErrorDismissed: boolean;
-}
-interface StateWithoutError extends BaseState {
- latestError: undefined;
- latestErrorDismissed: undefined;
-}
-export type State = StateWithError | StateWithoutError;
export const INITIAL_STATE: State = {
// TODO: Remove hardcoded zrxAssetData
@@ -32,7 +29,7 @@ export const INITIAL_STATE: State = {
ethUsdPrice: undefined,
latestBuyQuote: undefined,
latestError: undefined,
- latestErrorDismissed: undefined,
+ latestErrorDisplay: LatestErrorDisplay.Hidden,
};
export const reducer = (state: State = INITIAL_STATE, action: Action): State => {
@@ -61,18 +58,18 @@ export const reducer = (state: State = INITIAL_STATE, action: Action): State =>
return {
...state,
latestError: action.data,
- latestErrorDismissed: false,
+ latestErrorDisplay: LatestErrorDisplay.Present,
};
case ActionTypes.HIDE_ERROR:
return {
...state,
- latestErrorDismissed: true,
+ latestErrorDisplay: LatestErrorDisplay.Hidden,
};
case ActionTypes.CLEAR_ERROR:
return {
...state,
latestError: undefined,
- latestErrorDismissed: undefined,
+ latestErrorDisplay: LatestErrorDisplay.Hidden,
};
default:
return state;