pass new redux state and props through smart container

This commit is contained in:
Daniel Ternyak 2017-04-27 01:15:07 -05:00
parent e5c44afc75
commit 5d63e693ec

View File

@ -1,7 +1,12 @@
import GenerateWalletPasswordComponent from "./components/GenerateWalletPasswordComponent"; import GenerateWalletPasswordComponent from "./components/GenerateWalletPasswordComponent";
import React, {Component} from "react"; import React, {Component} from "react";
import {connect} from "react-redux"; import {connect} from "react-redux";
import {GENERATE_WALLET_FILE_ACTION, SHOW_GENERATE_WALLET_PASSWORD_ACTION} from "actions/generateWallet"; import {
GENERATE_WALLET_FILE_ACTION,
GENERATE_WALLET_HAS_DOWNLOADED_FILE_ACTION,
SHOW_GENERATE_WALLET_PASSWORD_ACTION,
GENERATE_WALLET_CONTINUE_TO_PAPER_ACTION
} from "actions/generateWallet";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
class GenerateWallet extends Component { class GenerateWallet extends Component {
@ -12,31 +17,18 @@ class GenerateWallet extends Component {
static propTypes = { static propTypes = {
generateWalletPassword: PropTypes.object, generateWalletPassword: PropTypes.object,
showPassword: PropTypes.bool, showPassword: PropTypes.bool,
hasDownloadedWalletFile: PropTypes.bool,
showGenerateWalletPasswordAction: PropTypes.func, showGenerateWalletPasswordAction: PropTypes.func,
generateWalletFileAction: PropTypes.func, generateWalletFileAction: PropTypes.func,
generateWalletFile: PropTypes.bool generateWalletHasDownloadedFileAction: PropTypes.func,
generateWalletFile: PropTypes.bool,
generateWalletContinueToPaperAction: PropTypes.func,
canProceedToPaper: PropTypes.bool
} }
render() { render() {
let {
generateWalletPassword,
showPassword,
showGenerateWalletPasswordAction,
generateWalletFileAction,
generateWalletFile
} = this.props;
let props = {
generateWalletPassword,
showPassword,
showGenerateWalletPasswordAction,
generateWalletFileAction,
generateWalletFile
}
return ( return (
<GenerateWalletPasswordComponent {...props}/> <GenerateWalletPasswordComponent {...this.props}/>
) )
} }
} }
@ -45,7 +37,9 @@ function mapStateToProps(state) {
return { return {
generateWalletPassword: state.form.generateWalletPassword, generateWalletPassword: state.form.generateWalletPassword,
generateWalletFile: state.generateWallet.generateWalletFile, generateWalletFile: state.generateWallet.generateWalletFile,
showPassword: state.generateWallet.showPassword showPassword: state.generateWallet.showPassword,
hasDownloadedWalletFile: state.generateWallet.hasDownloadedWalletFile,
canProceedToPaper: state.generateWallet.canProceedToPaper
} }
} }
@ -56,6 +50,12 @@ function mapDispatchToProps(dispatch) {
}, },
generateWalletFileAction: () => { generateWalletFileAction: () => {
dispatch(GENERATE_WALLET_FILE_ACTION()) dispatch(GENERATE_WALLET_FILE_ACTION())
},
generateWalletHasDownloadedFileAction: () => {
dispatch(GENERATE_WALLET_HAS_DOWNLOADED_FILE_ACTION())
},
generateWalletContinueToPaperAction: () => {
dispatch(GENERATE_WALLET_CONTINUE_TO_PAPER_ACTION())
} }
} }
} }