#74 switch user current projects display fix

parent d6073f38
......@@ -30,7 +30,6 @@ const ProfileBlock = () => {
}
const switchUser=()=>{
dispatch(fetchUsersAllFields());
// dispatch(fetchUsers())
handleClose()
handleOpenSwitchUser()
}
......
......@@ -13,24 +13,24 @@ const SwitchUserForm=({submitFormHandler, users})=> {
setCurrentUser(user)
setProjectsRole([])
}
console.log('projectsRoles ', projectsRoles)
useEffect(()=>{
if(currentUser?.members.length>0) {
let dataArray=[]
for (let member of currentUser.members ) {
let newProjectRole = {
const newProjectRole = {
"projectName":member.project.title,
"roleName":member.roleProject
}
setProjectsRole([...projectsRoles, newProjectRole ])
dataArray.push(newProjectRole)
}
setProjectsRole(dataArray)
}
},[ currentUser])
return (
<>
{/* <Box sx={style}> */}
{users?
<form onSubmit={(e)=>submitFormHandler(e,currentUser)}>
<Grid container direction="column" spacing={2}>
......@@ -67,15 +67,7 @@ const SwitchUserForm=({submitFormHandler, users})=> {
</Button>
</Grid>
{/* <Grid item>
<Button
onClick={()=>console.log('cancel form')}
color="primary"
variant="contained"
>
Отмена
</Button>
</Grid> */}
</Grid>
</Grid>
......@@ -83,7 +75,6 @@ const SwitchUserForm=({submitFormHandler, users})=> {
: <></>}
{/* </Box> */}
</>
)
}
......
......@@ -9,7 +9,6 @@ import Paper from '@mui/material/Paper';
const SwitchUserTable=({projectsRoles})=>{
return (
<TableContainer component={Paper}>
......@@ -31,7 +30,8 @@ const SwitchUserTable=({projectsRoles})=>{
</TableRow>
</TableHead>
<TableBody>
{projectsRoles.map((projectRole,index) => (
{projectsRoles.map((projectRole,index) =>{ return (
<TableRow
key={index}
sx={{ '&:last-child td, &:last-child th': { border: 0 } }}
......@@ -41,7 +41,7 @@ const SwitchUserTable=({projectsRoles})=>{
</TableCell>
<TableCell align="right">{projectRole.roleName}</TableCell>
</TableRow>
))}
)})}
</TableBody>
</Table>
</TableContainer>
......
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