댓글 수정
This commit is contained in:
parent
0968a616b6
commit
d954a1b68c
@ -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>
|
||||||
|
|||||||
@ -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) => {
|
||||||
|
|||||||
@ -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}`, {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user