import React from 'react'; import { withRouter, Link } from 'react-router-dom'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import Logout from './logout.jsx'; class CommonLinks extends React.Component { constructor(props) { super(props); this.state = { // } } render() { //render extra stuff let Extra; if (this.props.extra) { Extra = this.props.extra; } else { Extra = () => null; } //if logged in if (this.props.loggedIn) { return (

Return Home

Your Profile

Game Ladder

Change Password

this.props.history.push('/')} />
); } else { //if not logged in return (

Sign Up

Login

Recover Password

Return Home

Game Ladder

); } } } CommonLinks.propTypes = { onClickSignup: PropTypes.func, onClickLogin: PropTypes.func, onClickPasswordRecover: PropTypes.func, onClickHome: PropTypes.func, onClickProfile: PropTypes.func, onClickLadder: PropTypes.func, onClickPasswordChange: PropTypes.func }; function mapStoreToProps(store) { return { loggedIn: store.account.id !== 0 } } function mapDispatchToProps(dispatch) { return { // } } CommonLinks = connect(mapStoreToProps, mapDispatchToProps)(CommonLinks); export default withRouter(CommonLinks);