Username and user id now show in post data

This commit is contained in:
Aaron Sun
2019-10-27 23:11:24 -04:00
parent 5fa4caf0a3
commit 657277bcad
4 changed files with 51 additions and 59 deletions

View File

@@ -1,7 +1,7 @@
/* eslint-disable */
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
// import PropTypes from 'prop-types';
import PropTypes from 'prop-types';
// Material UI stuff
import AppBar from '@material-ui/core/AppBar';
@@ -10,70 +10,63 @@ import Button from '@material-ui/core/Button';
import withStyles from "@material-ui/core/styles/withStyles";
// Redux stuff
// import { logoutUser } from '../../redux/actions/userActions';
// import { connect } from 'react-redux';
// const styles = {
// form: {
// textAlign: "center"
// },
// textField: {
// marginBottom: 30
// },
// pageTitle: {
// marginBottom: 40
// },
// button: {
// positon: "relative",
// marginBottom: 30
// },
// progress: {
// position: "absolute"
// }
// };
import { connect } from 'react-redux';
const styles = {
form: {
textAlign: "center"
},
textField: {
marginBottom: 30
},
pageTitle: {
marginBottom: 40
},
button: {
positon: "relative",
marginBottom: 30
},
progress: {
position: "absolute"
}
};
export class Navbar extends Component {
render() {
export class Navbar extends Component {
render() {
const authenticated = this.props.user.authenticated;
return (
<AppBar>
<ToolBar>
<Button component={ Link } to='/'>
Home
</Button>
<Button component={ Link } to='/login'>
{!authenticated && <Button component={ Link } to='/login'>
Login
</Button>
<Button component={ Link } to='/signup'>
</Button>}
{!authenticated && <Button component={ Link } to='/signup'>
Sign Up
</Button>
<Button component={ Link } to='/logout'>
</Button>}
{authenticated && <Button component={ Link } to='/logout'>
Logout
</Button>
<Button component={ Link } to='/delete'>
</Button>}
{authenticated && <Button component={ Link } to='/delete'>
Delete Account
</Button>
</Button>}
</ToolBar>
</AppBar>
)
}
}
// const mapStateToProps = (state) => ({
// user: state.user
// })
const mapStateToProps = (state) => ({
user: state.user
})
// const mapActionsToProps = { logoutUser };
Navbar.propTypes = {
user: PropTypes.object.isRequired,
classes: PropTypes.object.isRequired
}
// Navbar.propTypes = {
// logoutUser: PropTypes.func.isRequired,
// user: PropTypes.object.isRequired,
// classes: PropTypes.object.isRequired
// }
export default connect(mapStateToProps)(withStyles(styles)(Navbar));
// export default connect(mapStateToProps, mapActionsToProps)(withStyles(styles)(Navbar));
export default Navbar;
// export default Navbar;