Skip to content

Commit

Permalink
Delete comment
Browse files Browse the repository at this point in the history
  • Loading branch information
AvilaKevin committed Apr 27, 2023
1 parent ab95f1e commit 2d5178a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion YouTubeClone/src/components/Comment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const Options = styled.div`
}
`;

function Comment({ comment }) {
function Comment({ comment, fetchComments }) {
// Se crean los estados para almacenar la informacion que se va a extraer del servidor
const [channel, setChannel] = useState({});

Expand Down Expand Up @@ -111,6 +111,7 @@ function Comment({ comment }) {
// Borra el comentario
const handleDelete = async () => {
await axios.delete(`/comments/${comment._id}`);
fetchComments()
};

return (
Expand Down
2 changes: 1 addition & 1 deletion YouTubeClone/src/components/Comments.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function Comments({ videoId }) {
}
{
comments.map(comment => (
<Comment key={comment._id} comment={comment} />
<Comment key={comment._id} comment={comment} fetchComments={fetchComments} />
))
}
</Container>
Expand Down

0 comments on commit 2d5178a

Please sign in to comment.