diff --git a/src/components/board/BoardComment.vue b/src/components/board/BoardComment.vue index 0ae221e..932c36f 100644 --- a/src/components/board/BoardComment.vue +++ b/src/components/board/BoardComment.vue @@ -56,7 +56,7 @@ :comment="child" :unknown="unknown" :isPlusButton="false" - :isLike="true" + :isLike="true" @submitComment="submitComment" @updateReaction="handleUpdateReaction" /> diff --git a/src/views/board/BoardView.vue b/src/views/board/BoardView.vue index 0820d92..4ee48ab 100644 --- a/src/views/board/BoardView.vue +++ b/src/views/board/BoardView.vue @@ -262,7 +262,7 @@ const handleCommentReaction = async ({ boardId, commentId, isLike, isDislike }) } }; -// 댓글 목록 조회 +// 댓글 목록 조회 (대댓글 포함) const fetchComments = async (page = 1) => { try { // 댓글 @@ -297,7 +297,7 @@ const fetchComments = async (page = 1) => { params: { LOCCMTPNT: comment.commentId } }); - // console.log(`📌 대댓글 데이터 (${comment.commentId}의 대댓글):`, replyResponse.data); + // console.log(`대댓글 데이터 (${comment.commentId}의 대댓글):`, replyResponse.data); if (replyResponse.data.data) { comment.children = replyResponse.data.data.map(reply => ({ @@ -379,15 +379,15 @@ const handleCommentSubmit = async ({ comment, password }) => { }; -// 대댓글 작성 +// 대댓글 추가 (부모 `BoardCommentList`로부터 이벤트 받아서 처리) const handleCommentReply = async (reply) => { try { - console.log('대댓글 작성 요청 데이터:', { - LOCBRDSEQ: currentBoardId.value, - LOCCMTRPY: reply.comment, - LOCCMTPWD: reply.password || null, - LOCCMTPNT: reply.parentId - }); + // console.log('대댓글 작성 요청 데이터:', { + // LOCBRDSEQ: currentBoardId.value, + // LOCCMTRPY: reply.comment, + // LOCCMTPWD: reply.password || null, + // LOCCMTPNT: reply.parentId + // }); const response = await axios.post(`board/${currentBoardId.value}/comment`, { LOCBRDSEQ: currentBoardId.value, @@ -397,11 +397,11 @@ const handleCommentReply = async (reply) => { }); // 응답 데이터를 자세히 로그로 확인 - console.log('대댓글 작성 응답:', { - status: response.status, - data: response.data, - headers: response.headers - }); + // console.log('대댓글 작성 응답:', { + // status: response.status, + // data: response.data, + // headers: response.headers + // }); if (response.status === 200) { if (response.data.code === 200) { // 서버 응답 코드도 확인 @@ -439,14 +439,14 @@ const deleteClick = (unknown) => { } }; -// 댓글 수정 버튼 클릭 +// 댓글 수정 버튼 클릭(대댓글 포함) const editComment = (comment) => { if (comment.isEditTextarea) { // 이미 수정창이 열려 있으면 닫기 comment.isEditTextarea = false; return; } - + if (unknown.value) { toggleCommentPassword(comment, "edit"); } else { @@ -465,7 +465,7 @@ const editComment = (comment) => { // } } -// 댓글 삭제 버튼 클릭 +// 댓글 삭제 버튼 클릭(대댓글 포함) const deleteComment = (comment) => { if (unknown.value) { if (comment.isEditTextarea) { @@ -550,7 +550,7 @@ const submitPassword = async () => { } }; -// 댓글 비밀번호 제출 +// 댓글 삭제 (비밀번호 확인 후) const submitCommentPassword = async (comment, password) => { if (!password) { passwordCommentAlert.value = "비밀번호를 입력해주세요."; @@ -578,7 +578,7 @@ const submitCommentPassword = async (comment, password) => { passwordCommentAlert.value = "비밀번호가 일치하지 않습니다."; } } catch (error) { - passwordCommentAlert.value = "비밀번호 검증 중 오류가 발생했습니다."; + passwordCommentAlert.value = "비밀번호가 일치하지 않습니다"; } }; @@ -606,7 +606,7 @@ const deletePost = async () => { } }; -// 댓글 삭제 +// 댓글 삭제 (대댓글 포함) const deleteReplyComment = async (comment) => { if (!confirm("정말 이 댓글을 삭제하시겠습니까?")) return; // console.log("댓글 ID:", comment); @@ -631,13 +631,7 @@ const deleteReplyComment = async (comment) => { } }; -// 댓글 수정 취소 -const handleCancelEdit = (comment) => { - console.log("BoardView.vue - 댓글 수정 취소:", comment); - comment.isEditTextarea = false; -}; - -// 댓글 수정 확인 +// 댓글 수정 확인 (대댓글 포함) const handleSubmitEdit = async (comment, editedContent) => { try { const response = await axios.put(`board/comment/${comment.commentId}`, { @@ -653,6 +647,12 @@ const handleSubmitEdit = async (comment, editedContent) => { } }; +// 댓글 수정 취소 (대댓글 포함) +const handleCancelEdit = (comment) => { + console.log("BoardView.vue - 댓글 수정 취소:", comment); + comment.isEditTextarea = false; +}; + // 페이지 변경 const handlePageChange = (page) => { if (page !== pagination.value.currentPage) {