diff --git a/client/src/layouts/Dashboard/components/Sidebar/Sidebar.js b/client/src/layouts/Dashboard/components/Sidebar/Sidebar.js index acf72fa..a105fef 100644 --- a/client/src/layouts/Dashboard/components/Sidebar/Sidebar.js +++ b/client/src/layouts/Dashboard/components/Sidebar/Sidebar.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import { connect } from 'react-redux'; import { NavLink } from 'react-router-dom'; import { withStyles, @@ -18,7 +19,7 @@ import styles from './styles'; class Sidebar extends Component { render() { - const { classes } = this.props; + const { classes, user } = this.props; return (
@@ -87,20 +88,21 @@ class Sidebar extends Component { primary="Reservations" /> - - - - - - - + {user && user.role === 'superadmin' && ( + + + + + + + )} ({ + user: state.authState.user +}); + +const mapDispatchToProps = {}; + +export default connect( + mapStateToProps, + mapDispatchToProps +)(withStyles(styles)(Sidebar)); diff --git a/client/src/layouts/Dashboard/components/Topbar/Topbar.js b/client/src/layouts/Dashboard/components/Topbar/Topbar.js index 891edc7..0650aa7 100644 --- a/client/src/layouts/Dashboard/components/Topbar/Topbar.js +++ b/client/src/layouts/Dashboard/components/Topbar/Topbar.js @@ -53,7 +53,7 @@ class Topbar extends Component { - Return + Cinema App Home - {user && user.role === 'superadmin' && ( + {user && user.role !== 'guest' && ( Dashboard @@ -102,7 +102,7 @@ class Navbar extends Component { Home - {user && user.role === 'superadmin' && ( + {user && user.role !== 'guest' && (
  • Dashboard diff --git a/client/src/pages/Public/Login/components/LoginForm.js b/client/src/pages/Public/Login/components/LoginForm.js index a8fb50b..78146ee 100644 --- a/client/src/pages/Public/Login/components/LoginForm.js +++ b/client/src/pages/Public/Login/components/LoginForm.js @@ -83,7 +83,7 @@ function LoginForm(props) { const handleFieldChange = e => setValues({ ...values, - [e.target.name]: [e.target.value] + [e.target.name]: e.target.value }); return ( @@ -110,6 +110,7 @@ function LoginForm(props) { type="text" value={values.username} variant="outlined" + placeholder="Use demo1" /> diff --git a/server/src/routes/users.js b/server/src/routes/users.js index 366163f..3da2127 100644 --- a/server/src/routes/users.js +++ b/server/src/routes/users.js @@ -200,7 +200,8 @@ router.patch("/users/:id", auth, async (req, res) => { "phone", "username", "email", - "password" + "password", + "role" ]; const isValidOperation = updates.every(update => allowedUpdates.includes(update)