diff --git a/Site Web/client/src/components/Post/ActionComment.js b/Site Web/client/src/components/Post/ActionComment.js
index 8bc6a03c..a46668ec 100644
--- a/Site Web/client/src/components/Post/ActionComment.js
+++ b/Site Web/client/src/components/Post/ActionComment.js
@@ -7,7 +7,8 @@ import { UidContext } from '../AppContext';
const ActionComment = ( { commentaire , postId}) => {
const [createur, setCreateur] = useState(false);
const [edit, setEdit] = useState(false);
- const [message,setMessage] = useState('');
+ const [message,setMessage] = useState(commentaire.text);
+
const uid = useContext(UidContext);
const dispatch = useDispatch();
@@ -15,13 +16,14 @@ const ActionComment = ( { commentaire , postId}) => {
e.preventDefault();
if(message){
dispatch(editComment(postId, commentaire._id, message));
- setMessage('');
setEdit(false);
}
};
const handleDelete = () => {
dispatch(deleteComment(postId, commentaire._id));
+ setMessage('commantaire suprimer');
+ setEdit(false);
};
useEffect(() => {
@@ -36,6 +38,9 @@ const ActionComment = ( { commentaire , postId}) => {
}, [uid, commentaire.commenterId]);
return (
+ <>
+
{message}
+
{createur && edit === false && (
setEdit(!edit)}>
@@ -47,14 +52,14 @@ const ActionComment = ( { commentaire , postId}) => {
className="edit-comment-form">
-
-
{
- if(window.confirm("Etes-vous sur de supprimer ce commentaire ?")){
- handleDelete();
- }
- }}>
-
-
+
+ {
+ if(window.confirm("Etes-vous sur de supprimer ce commentaire ?")){
+ handleDelete();
+ }
+ }}>
+
+
@@ -66,6 +71,7 @@ const ActionComment = ( { commentaire , postId}) => {
)}
+ >
);
};
diff --git a/Site Web/client/src/components/Post/Comment.js b/Site Web/client/src/components/Post/Comment.js
index f72509b8..ae4a9823 100644
--- a/Site Web/client/src/components/Post/Comment.js
+++ b/Site Web/client/src/components/Post/Comment.js
@@ -50,8 +50,7 @@ const Comment = ({ post }) => {
{timestampParser(comment.timestamp)}
diff --git a/Site Web/client/src/components/Post/PostNouvelleAffichage.js b/Site Web/client/src/components/Post/PostNouvelleAffichage.js
index f639dad5..0243cab8 100644
--- a/Site Web/client/src/components/Post/PostNouvelleAffichage.js
+++ b/Site Web/client/src/components/Post/PostNouvelleAffichage.js
@@ -46,7 +46,12 @@ const PostNouvelleAffichage = ( { post } ) => {
useEffect(() => {
- !isEmpty(usersData[0]) && setIsLoading(false)
+ try {
+ !isEmpty(usersData[0]) && setIsLoading(false)
+ }
+ catch (error){
+
+ }
})
diff --git a/Site Web/client/src/components/UserProfil/SuggestFriends.js b/Site Web/client/src/components/UserProfil/SuggestFriends.js
index a4577dad..2a5c50b0 100644
--- a/Site Web/client/src/components/UserProfil/SuggestFriends.js
+++ b/Site Web/client/src/components/UserProfil/SuggestFriends.js
@@ -66,18 +66,19 @@ const SuggestFriends = () => {
}
}, [userData, usersData, change])
- return (
+ try {
+ return (
Vous pourriez suivre
{chargement ? (
-
+
) : (
-
+
{friends && friends.map((user) => {
- for(let i = 0; i < usersData.length; i++){
- if(user === usersData[i]._id){
+ for (let i = 0; i < usersData.length; i++) {
+ if (user === usersData[i]._id) {
return (
@@ -96,7 +97,11 @@ const SuggestFriends = () => {
)}
- );
+ );
+ }
+ catch (error){
+ return
Loading...
+ }
};
export default SuggestFriends;
\ No newline at end of file