Commit 8b84d820 authored by ns17's avatar ns17

fixing drawer and initial pages

parent 2b393ddb
Pipeline #22745 failed with stages
in 51 seconds
......@@ -106,10 +106,10 @@ const useStyles = makeStyles(theme => ({
}),
);
function ListItemLink(props) {
const { icon, text, to } = props;
const { icon, text, to , CloseMenu} = props;
return (
<li>
<ListItem button component={Link} to={to} >
<ListItem button onClick={CloseMenu} component={Link} to={to} >
<ListItemIcon>{icon}</ListItemIcon>
<ListItemText><Typography style={{fontSize:"15px"}}>{text}</Typography></ListItemText>
</ListItem>
......@@ -123,7 +123,7 @@ export function Options(props) {
const [role, setRole] = React.useState("")
React.useEffect(()=>{
const fetchData = async () => {
const user = await getUserId();
const user = await getUserId();
try {
const result = await api.get(`usuarios/${user}/role`);
console.log(result)
......@@ -195,7 +195,7 @@ switch (role) {
return (
<List>
{ list_options.map((i)=>{
return <ListItemLink icon={i.icon} text={i.text} to={i.link} />
return <ListItemLink icon={i.icon} text={i.text} to={i.link} CloseMenu={props.CloseMenu}/>
})
}
......@@ -214,14 +214,17 @@ export function DrawerMenu(props) {
},[loginChange]);
function _logout() {
logout();
props.handleDrawerClose();
setLoginChange(!loginChange);
}
return (<Drawer
className={classes.drawer}
variant="persistent"
variant="temporary"
anchor="left"
open={props.open}
onClose={props.handleDrawerClose}
onOpen={props.handleDrawerOpen}
classes={{
paper: classes.drawerPaper,
}}
......@@ -249,14 +252,14 @@ export function DrawerMenu(props) {
<Divider />
</Grid>
<Grid item xs>
{ auth? <Options /> : <Login loginChange={loginChange} setLoginChange={setLoginChange}/> }
{ auth? <Options CloseMenu={props.handleDrawerClose} /> : <Login CloseMenu={props.handleDrawerClose} loginChange={loginChange} setLoginChange={setLoginChange}/> }
</Grid>
<Grid item xs>
<Divider />
</Grid>
{ auth &&
<Grid item align="center" xs>
<Button onClick={_logout} variant="contained" color="secondary">logout</Button>
<Button onClick={_logout} component={Link} to="/" variant="contained" color="secondary">logout</Button>
</Grid>
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment