MyCrypto/common/reducers/generateWallet.js

57 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-06-26 22:27:55 +00:00
// @flow
import {
GENERATE_WALLET_SHOW_PASSWORD,
GENERATE_WALLET_FILE,
GENERATE_WALLET_DOWNLOAD_FILE,
GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER
} from 'actions/generateWalletConstants';
2017-06-26 22:27:55 +00:00
export type State = {
showPassword: boolean,
generateWalletFile: boolean,
hasDownloadedWalletFile: boolean,
canProceedToPaper: boolean
}
const initialState: State = {
showPassword: false,
generateWalletFile: false,
hasDownloadedWalletFile: false,
canProceedToPaper: false
};
2017-06-26 22:27:55 +00:00
export function generateWallet(state: State = initialState, action): State {
switch (action.type) {
case GENERATE_WALLET_SHOW_PASSWORD: {
return {
...state,
showPassword: !state.showPassword
};
}
case GENERATE_WALLET_FILE: {
return {
...state,
generateWalletFile: true
};
}
case GENERATE_WALLET_DOWNLOAD_FILE: {
return {
...state,
hasDownloadedWalletFile: true
};
}
case GENERATE_WALLET_CONFIRM_CONTINUE_TO_PAPER: {
return {
...state,
canProceedToPaper: true
};
}
default:
return state;
}
}