1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-07-15 11:08:18 +00:00
trezor-wallet/src/js/reducers/SummaryReducer.js
2018-04-11 12:06:46 +02:00

51 lines
944 B
JavaScript

/* @flow */
'use strict';
import * as SUMMARY from '../actions/constants/summary';
export type State = {
+deviceState: ?string;
+deviceId: ?string;
+deviceInstance: ?string;
+accountIndex: ?number;
+network: ?string;
location: string;
details: boolean;
selectedToken: any;
}
export const initialState: State = {
deviceState: null,
deviceId: null,
deviceInstance: null,
accountIndex: null,
network: null,
location: '',
details: true,
selectedToken: null
};
export default (state: State = initialState, action: any): State => {
switch (action.type) {
case SUMMARY.INIT :
return action.state;
case SUMMARY.DISPOSE :
return initialState;
case SUMMARY.DETAILS_TOGGLE :
return {
...state,
details: !state.details
}
default:
return state;
}
}