frontend: Ajouter/Retirer une fonction des favoris

This commit is contained in:
Divlo
2020-04-10 22:50:24 +02:00
parent 0ac2fbf3ab
commit 02058fc2fb
8 changed files with 113 additions and 45 deletions

View File

@ -11,6 +11,7 @@ const CommentCard = forwardRef((props, ref) => {
const { isAuth, user } = useContext(UserContext);
const deleteCommentById = async () => {
props.manageComment.setLoadingComments(true);
if (isAuth && user.token != undefined) {
try {
await api.delete(`/comments?commentId=${props.id}`, { headers: { 'Authorization': user.token } });
@ -20,6 +21,7 @@ const CommentCard = forwardRef((props, ref) => {
props.manageComment.setCommentsData({ hasMore: props.manageComment.commentsData.hasMore, rows: newCommentsData.rows });
} catch {}
}
props.manageComment.setLoadingComments(false);
}
return (