1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-07-15 19:18:21 +00:00
trezor-wallet/src/js/reducers/ReceiveReducer.js

51 lines
1.1 KiB
JavaScript

/* @flow */
'use strict';
import * as RECEIVE from '../actions/constants/receive';
export type State = {
+deviceState: ?string;
+accountIndex: ?number;
+network: ?string;
location: string;
addressVerified: boolean;
adressUnverified: boolean;
}
export const initialState: State = {
deviceState: null,
accountIndex: null,
network: null,
location: '',
addressVerified: false,
addressUnverified: false,
};
export default (state: State = initialState, action: any): State => {
switch (action.type) {
case RECEIVE.INIT :
return action.state;
case RECEIVE.DISPOSE :
return initialState;
case RECEIVE.SHOW_ADDRESS :
return {
...state,
addressVerified: true,
addressUnverified: false
}
case RECEIVE.SHOW_UNVERIFIED_ADDRESS :
return {
...state,
addressVerified: false,
addressUnverified: true
}
default:
return state;
}
}