Commit 7e098957 authored by Ibadullina Inabat's avatar Ibadullina Inabat

Merge branch 'task-107-fix/add_checking_front' into 'development'

Task 107 fix/add checking front

See merge request !82
parents 8827bdc4 186d716f
......@@ -5,17 +5,21 @@ import { useDispatch, useSelector } from "react-redux";
import DeleteIcon from "@mui/icons-material/Delete";
import { deleteMember } from "../../../store/actions/projectsActions";
const ProjectMembersItem = ({ displayName, roleProject, id, roleProjectOfAuthor, userId }) => {
const ProjectMembersItem = ({ displayName, roleProject, id, roleProjectOfAuthor, userId, members }) => {
console.log(displayName)
const dispatch = useDispatch();
const user = useSelector(state => state.users)
let params = useParams()
console.log(params)
console.log(members)
console.log(userId)
const { projects, project } = useSelector(state => state.projects);
const deleteHandle = (userId, projectId) => {
dispatch(deleteMember(userId, params.id));
if (members.length > 1) {
dispatch(deleteMember(userId, params.id))
} else {
alert("Нельзя удалить автора проекта")
}
};
return <>
......
......@@ -13,6 +13,7 @@ const ProjectMembersList = ({members, roleProjectOfAuthor}) => {
key={member.id}
roleProjectOfAuthor={roleProjectOfAuthor}
userId={member?.user?.id}
members={members}
/>
})}
</Grid>
......
......@@ -12,7 +12,7 @@ const FullProject = () => {
const { projects, project } = useSelector(state => state.projects);
const users = useSelector(state => state.users.users);
const user = useSelector(state => state.users.user);
const dispatch = useDispatch();
const params = useParams()
......@@ -24,7 +24,7 @@ const FullProject = () => {
dispatch(fetchUsers())
}, [dispatch]);
console.log(users)
console.log(user)
useEffect(() => {
dispatch(fetchProject(params.id))
......@@ -55,8 +55,8 @@ const FullProject = () => {
<strong>
<br></br>
<div style={{display: 'flex', direction: 'column'}}>
Участники проекта:
<NewMember members={project?.project?.members} />
Участники проекта: {(project?.project?.members[0]?.user.displayName === user.displayName) ? <NewMember members={project?.project?.members} /> : null}
</div>
......
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