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