댓글 수정

This commit is contained in:
kimdaae328 2025-02-28 00:58:38 +09:00
parent 0968a616b6
commit d954a1b68c
3 changed files with 17 additions and 7 deletions

View File

@ -59,12 +59,13 @@
:isCommentProfile="true" :isCommentProfile="true"
:isCommentAuthor="child.isCommentAuthor" :isCommentAuthor="child.isCommentAuthor"
:isCommentPassword="isCommentPassword" :isCommentPassword="isCommentPassword"
@editClick="$emit('editClick', $event)" @editClick="handleReplyEditClick "
@deleteClick="$emit('deleteClick', child)" @deleteClick="$emit('deleteClick', child)"
@submitEdit="(comment, editedContent) => $emit('submitEdit', comment, editedContent)" @submitEdit="(comment, editedContent) => $emit('submitEdit', comment, editedContent)"
@cancelEdit="$emit('cancelEdit', child)" @cancelEdit="$emit('cancelEdit', child)"
@submitComment="submitComment" @submitComment="submitComment"
@updateReaction="handleUpdateReaction" @updateReaction="handleUpdateReaction"
@submitPassword="logPasswordAndEmit"
/> />
</li> </li>
</ul> </ul>
@ -143,6 +144,7 @@ const handleUpdateReaction = (reactionData) => {
// //
const logPasswordAndEmit = () => { const logPasswordAndEmit = () => {
console.log('비밀번호 확인',password.value)
emit('submitPassword', props.comment, password.value); emit('submitPassword', props.comment, password.value);
password.value = ""; password.value = "";
}; };
@ -162,4 +164,9 @@ const handleEditClick = () => {
emit('editClick', props.comment); emit('editClick', props.comment);
} }
const handleReplyEditClick = (event) => {
console.log("📌 editClick 이벤트 실행됨! 전달된 데이터:", event);
emit('editClick', event);
}
</script> </script>

View File

@ -78,7 +78,11 @@ const submitPassword = (comment, password) => {
}; };
const handleEditClick = (comment) => { const handleEditClick = (comment) => {
emit('editClick', comment); if (comment.parentId) {
emit('deleteClick', comment); //
} else {
emit('deleteClick', comment); //
}
}; };
const handleSubmitEdit = (comment, editedContent) => { const handleSubmitEdit = (comment, editedContent) => {

View File

@ -482,7 +482,6 @@ const findCommentById = (commentId, commentsList) => {
// //
const editComment = (comment) => { const editComment = (comment) => {
// //
const targetComment = findCommentById(comment.commentId, comments.value); const targetComment = findCommentById(comment.commentId, comments.value);
@ -590,9 +589,10 @@ const submitPassword = async () => {
// ( ) // ( )
const submitCommentPassword = async (comment, password) => { const submitCommentPassword = async (comment, password) => {
console.log('야야야')
// console.log(" :", password); console.log("비밀번호 :", password);
// console.log(" ID:", comment.commentId); console.log("댓글 ID:", comment.commentId);
if (!password) { if (!password) {
passwordCommentAlert.value = "비밀번호를 입력해주세요."; passwordCommentAlert.value = "비밀번호를 입력해주세요.";
@ -607,7 +607,7 @@ const submitCommentPassword = async (comment, password) => {
LOCCMTPWD: password, LOCCMTPWD: password,
LOCCMTSEQ: comment.commentId, LOCCMTSEQ: comment.commentId,
}); });
// console.log(" :", response.data); console.log("✅ 서버 응답 데이터:", response.data);
if (response.data.code === 200 && response.data.data === true) { if (response.data.code === 200 && response.data.data === true) {
passwordCommentAlert.value = ""; passwordCommentAlert.value = "";
@ -671,7 +671,6 @@ const deletePost = async () => {
// ( ) // ( )
const deleteReplyComment = async (comment) => { const deleteReplyComment = async (comment) => {
if (!confirm("정말 이 댓글을 삭제하시겠습니까?")) return; if (!confirm("정말 이 댓글을 삭제하시겠습니까?")) return;
console.log("댓글 수정, 대댓글도?");
try { try {
const response = await axios.delete(`board/comment/${comment.commentId}`, { const response = await axios.delete(`board/comment/${comment.commentId}`, {