1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-01-01 03:40:53 +00:00
trezor-wallet/src/js/reducers/SummaryReducer.js

42 lines
892 B
JavaScript
Raw Normal View History

2018-02-20 09:30:36 +00:00
/* @flow */
'use strict';
import * as ACCOUNT from '../actions/constants/account';
2018-02-20 09:30:36 +00:00
import * as SUMMARY from '../actions/constants/summary';
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,
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) {
case ACCOUNT.DISPOSE :
return initialState;
2018-02-20 09:30:36 +00:00
case SUMMARY.INIT :
return action.state;
case SUMMARY.DISPOSE :
return initialState;
case SUMMARY.DETAILS_TOGGLE :
return {
...state,
details: !state.details
}
default:
return state;
}
}