From 580ab39e176379da3b59fff8c24bd3500c3e79fe Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Wed, 13 Sep 2017 21:37:22 +0300 Subject: [PATCH] Add currentUserHasOrders info to SecurityPage Verification props to SecurityPage --- src/containers/SecurityPage/SecurityPage.js | 22 +++++++++++++++++++ .../SecurityPage/SecurityPage.test.js | 2 ++ .../__snapshots__/SecurityPage.test.js.snap | 6 ++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/containers/SecurityPage/SecurityPage.js b/src/containers/SecurityPage/SecurityPage.js index 05786a79..96ccbfcd 100644 --- a/src/containers/SecurityPage/SecurityPage.js +++ b/src/containers/SecurityPage/SecurityPage.js @@ -3,6 +3,7 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; import * as propTypes from '../../util/propTypes'; +import { sendVerificationEmail } from '../../ducks/user.duck'; import { logout, authenticationInProgress } from '../../ducks/Auth.duck'; import { manageDisableScrolling, isScrollingDisabled } from '../../ducks/UI.duck'; import { PageLayout, Topbar } from '../../components'; @@ -13,6 +14,7 @@ export const SecurityPageComponent = props => { authInProgress, currentUser, currentUserHasListings, + currentUserHasOrders, history, isAuthenticated, location, @@ -20,6 +22,9 @@ export const SecurityPageComponent = props => { notificationCount, onLogout, onManageDisableScrolling, + sendVerificationEmailInProgress, + sendVerificationEmailError, + onResendVerificationEmail, } = props; return ( @@ -28,12 +33,16 @@ export const SecurityPageComponent = props => { authInProgress={authInProgress} currentUser={currentUser} currentUserHasListings={currentUserHasListings} + currentUserHasOrders={currentUserHasOrders} history={history} isAuthenticated={isAuthenticated} location={location} notificationCount={notificationCount} onLogout={onLogout} onManageDisableScrolling={onManageDisableScrolling} + onResendVerificationEmail={onResendVerificationEmail} + sendVerificationEmailInProgress={sendVerificationEmailInProgress} + sendVerificationEmailError={sendVerificationEmailError} /> ); @@ -42,8 +51,10 @@ export const SecurityPageComponent = props => { SecurityPageComponent.defaultProps = { authInfoError: null, currentUser: null, + currentUserHasOrders: null, logoutError: null, notificationCount: 0, + sendVerificationEmailError: null, }; const { bool, func, instanceOf, number, object, shape } = PropTypes; @@ -53,11 +64,15 @@ SecurityPageComponent.propTypes = { authInProgress: bool.isRequired, currentUser: propTypes.currentUser, currentUserHasListings: bool.isRequired, + currentUserHasOrders: bool, isAuthenticated: bool.isRequired, logoutError: instanceOf(Error), notificationCount: number, onLogout: func.isRequired, onManageDisableScrolling: func.isRequired, + sendVerificationEmailInProgress: bool.isRequired, + sendVerificationEmailError: instanceOf(Error), + onResendVerificationEmail: func.isRequired, // from withRouter history: shape({ @@ -73,17 +88,23 @@ const mapStateToProps = state => { const { currentUser, currentUserHasListings, + currentUserHasOrders, currentUserNotificationCount: notificationCount, + sendVerificationEmailInProgress, + sendVerificationEmailError, } = state.user; return { authInfoError, authInProgress: authenticationInProgress(state), currentUser, currentUserHasListings, + currentUserHasOrders, currentUserNotificationCount: notificationCount, isAuthenticated, logoutError, scrollingDisabled: isScrollingDisabled(state), + sendVerificationEmailInProgress, + sendVerificationEmailError, }; }; @@ -91,6 +112,7 @@ const mapDispatchToProps = dispatch => ({ onLogout: historyPush => dispatch(logout(historyPush)), onManageDisableScrolling: (componentId, disableScrolling) => dispatch(manageDisableScrolling(componentId, disableScrolling)), + onResendVerificationEmail: () => dispatch(sendVerificationEmail()), }); const SecurityPage = compose(connect(mapStateToProps, mapDispatchToProps), withRouter)( diff --git a/src/containers/SecurityPage/SecurityPage.test.js b/src/containers/SecurityPage/SecurityPage.test.js index 432b03f8..ba47abfc 100644 --- a/src/containers/SecurityPage/SecurityPage.test.js +++ b/src/containers/SecurityPage/SecurityPage.test.js @@ -17,6 +17,8 @@ describe('SecurityPage', () => { isAuthenticated={false} onLogout={noop} onManageDisableScrolling={noop} + sendVerificationEmailInProgress={false} + onResendVerificationEmail={noop} /> ); expect(tree).toMatchSnapshot(); diff --git a/src/containers/SecurityPage/__snapshots__/SecurityPage.test.js.snap b/src/containers/SecurityPage/__snapshots__/SecurityPage.test.js.snap index 7a5c838a..a2eaf4d9 100644 --- a/src/containers/SecurityPage/__snapshots__/SecurityPage.test.js.snap +++ b/src/containers/SecurityPage/__snapshots__/SecurityPage.test.js.snap @@ -7,6 +7,7 @@ exports[`SecurityPage matches snapshot 1`] = ` authInProgress={false} currentUser={null} currentUserHasListings={false} + currentUserHasOrders={null} history={ Object { "push": [Function], @@ -20,6 +21,9 @@ exports[`SecurityPage matches snapshot 1`] = ` } notificationCount={0} onLogout={[Function]} - onManageDisableScrolling={[Function]} /> + onManageDisableScrolling={[Function]} + onResendVerificationEmail={[Function]} + sendVerificationEmailError={null} + sendVerificationEmailInProgress={false} /> `;