2018-02-20 09:30:36 +00:00
|
|
|
/* @flow */
|
2018-07-30 10:52:13 +00:00
|
|
|
|
2018-02-20 09:30:36 +00:00
|
|
|
|
2018-08-14 13:11:52 +00:00
|
|
|
import * as ACCOUNT from 'actions/constants/account';
|
|
|
|
import * as SUMMARY from 'actions/constants/summary';
|
2018-08-14 12:56:47 +00:00
|
|
|
import type { Action } from 'flowtype';
|
2018-04-16 21:19:50 +00:00
|
|
|
import type { NetworkToken } from './LocalStorageReducer';
|
2018-02-20 09:30:36 +00:00
|
|
|
|
|
|
|
export type State = {
|
|
|
|
details: boolean;
|
2018-04-16 21:19:50 +00:00
|
|
|
selectedToken: ?NetworkToken;
|
2018-02-20 09:30:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const initialState: State = {
|
|
|
|
details: true,
|
2018-07-30 10:52:13 +00:00
|
|
|
selectedToken: null,
|
|
|
|
};
|
2018-02-20 09:30:36 +00:00
|
|
|
|
2018-04-16 21:19:50 +00:00
|
|
|
export default (state: State = initialState, action: Action): State => {
|
2018-02-20 09:30:36 +00:00
|
|
|
switch (action.type) {
|
2018-07-30 10:52:13 +00:00
|
|
|
case ACCOUNT.DISPOSE:
|
2018-05-25 09:26:36 +00:00
|
|
|
return initialState;
|
|
|
|
|
2018-07-30 10:52:13 +00:00
|
|
|
case SUMMARY.INIT:
|
2018-02-20 09:30:36 +00:00
|
|
|
return action.state;
|
|
|
|
|
2018-07-30 10:52:13 +00:00
|
|
|
case SUMMARY.DISPOSE:
|
2018-02-20 09:30:36 +00:00
|
|
|
return initialState;
|
|
|
|
|
2018-07-30 10:52:13 +00:00
|
|
|
case SUMMARY.DETAILS_TOGGLE:
|
2018-02-20 09:30:36 +00:00
|
|
|
return {
|
|
|
|
...state,
|
2018-07-30 10:52:13 +00:00
|
|
|
details: !state.details,
|
|
|
|
};
|
2018-02-20 09:30:36 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
2018-07-30 10:52:13 +00:00
|
|
|
};
|