댓글 수정
This commit is contained in:
parent
0968a616b6
commit
d954a1b68c
@ -59,12 +59,13 @@
|
||||
:isCommentProfile="true"
|
||||
:isCommentAuthor="child.isCommentAuthor"
|
||||
:isCommentPassword="isCommentPassword"
|
||||
@editClick="$emit('editClick', $event)"
|
||||
@editClick="handleReplyEditClick "
|
||||
@deleteClick="$emit('deleteClick', child)"
|
||||
@submitEdit="(comment, editedContent) => $emit('submitEdit', comment, editedContent)"
|
||||
@cancelEdit="$emit('cancelEdit', child)"
|
||||
@submitComment="submitComment"
|
||||
@updateReaction="handleUpdateReaction"
|
||||
@submitPassword="logPasswordAndEmit"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
@ -143,6 +144,7 @@ const handleUpdateReaction = (reactionData) => {
|
||||
|
||||
// 비밀번호 확인
|
||||
const logPasswordAndEmit = () => {
|
||||
console.log('비밀번호 확인',password.value)
|
||||
emit('submitPassword', props.comment, password.value);
|
||||
password.value = "";
|
||||
};
|
||||
@ -162,4 +164,9 @@ const handleEditClick = () => {
|
||||
emit('editClick', props.comment);
|
||||
}
|
||||
|
||||
const handleReplyEditClick = (event) => {
|
||||
console.log("📌 editClick 이벤트 실행됨! 전달된 데이터:", event);
|
||||
emit('editClick', event);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@ -78,7 +78,11 @@ const submitPassword = (comment, password) => {
|
||||
};
|
||||
|
||||
const handleEditClick = (comment) => {
|
||||
emit('editClick', comment);
|
||||
if (comment.parentId) {
|
||||
emit('deleteClick', comment); // 대댓글
|
||||
} else {
|
||||
emit('deleteClick', comment); // 댓글
|
||||
}
|
||||
};
|
||||
|
||||
const handleSubmitEdit = (comment, editedContent) => {
|
||||
|
||||
@ -482,7 +482,6 @@ const findCommentById = (commentId, commentsList) => {
|
||||
|
||||
// 댓글 수정 버튼 클릭
|
||||
const editComment = (comment) => {
|
||||
|
||||
// 부모 또는 대댓글을 찾아서 가져오기
|
||||
const targetComment = findCommentById(comment.commentId, comments.value);
|
||||
|
||||
@ -590,9 +589,10 @@ const submitPassword = async () => {
|
||||
|
||||
// 댓글 삭제 (비밀번호 확인 후)
|
||||
const submitCommentPassword = async (comment, password) => {
|
||||
console.log('야야야')
|
||||
|
||||
// console.log("비밀번호 :", password);
|
||||
// console.log("댓글 ID:", comment.commentId);
|
||||
console.log("비밀번호 :", password);
|
||||
console.log("댓글 ID:", comment.commentId);
|
||||
|
||||
if (!password) {
|
||||
passwordCommentAlert.value = "비밀번호를 입력해주세요.";
|
||||
@ -607,7 +607,7 @@ const submitCommentPassword = async (comment, password) => {
|
||||
LOCCMTPWD: password,
|
||||
LOCCMTSEQ: comment.commentId,
|
||||
});
|
||||
// console.log("✅ 서버 응답 데이터:", response.data);
|
||||
console.log("✅ 서버 응답 데이터:", response.data);
|
||||
|
||||
if (response.data.code === 200 && response.data.data === true) {
|
||||
passwordCommentAlert.value = "";
|
||||
@ -671,7 +671,6 @@ const deletePost = async () => {
|
||||
// 댓글 삭제 (대댓글 포함)
|
||||
const deleteReplyComment = async (comment) => {
|
||||
if (!confirm("정말 이 댓글을 삭제하시겠습니까?")) return;
|
||||
console.log("댓글 수정, 대댓글도?");
|
||||
|
||||
try {
|
||||
const response = await axios.delete(`board/comment/${comment.commentId}`, {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user