.
This commit is contained in:
parent
c88b01f78f
commit
cd01f0767e
@ -262,7 +262,7 @@ const handleCommentReaction = async ({ boardId, commentId, isLike, isDislike })
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 댓글 목록 조회
|
// 댓글 목록 조회 (대댓글 포함)
|
||||||
const fetchComments = async (page = 1) => {
|
const fetchComments = async (page = 1) => {
|
||||||
try {
|
try {
|
||||||
// 댓글
|
// 댓글
|
||||||
@ -297,7 +297,7 @@ const fetchComments = async (page = 1) => {
|
|||||||
params: { LOCCMTPNT: comment.commentId }
|
params: { LOCCMTPNT: comment.commentId }
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log(`📌 대댓글 데이터 (${comment.commentId}의 대댓글):`, replyResponse.data);
|
// console.log(`대댓글 데이터 (${comment.commentId}의 대댓글):`, replyResponse.data);
|
||||||
|
|
||||||
if (replyResponse.data.data) {
|
if (replyResponse.data.data) {
|
||||||
comment.children = replyResponse.data.data.map(reply => ({
|
comment.children = replyResponse.data.data.map(reply => ({
|
||||||
@ -379,15 +379,15 @@ const handleCommentSubmit = async ({ comment, password }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 대댓글 작성
|
// 대댓글 추가 (부모 `BoardCommentList`로부터 이벤트 받아서 처리)
|
||||||
const handleCommentReply = async (reply) => {
|
const handleCommentReply = async (reply) => {
|
||||||
try {
|
try {
|
||||||
console.log('대댓글 작성 요청 데이터:', {
|
// console.log('대댓글 작성 요청 데이터:', {
|
||||||
LOCBRDSEQ: currentBoardId.value,
|
// LOCBRDSEQ: currentBoardId.value,
|
||||||
LOCCMTRPY: reply.comment,
|
// LOCCMTRPY: reply.comment,
|
||||||
LOCCMTPWD: reply.password || null,
|
// LOCCMTPWD: reply.password || null,
|
||||||
LOCCMTPNT: reply.parentId
|
// LOCCMTPNT: reply.parentId
|
||||||
});
|
// });
|
||||||
|
|
||||||
const response = await axios.post(`board/${currentBoardId.value}/comment`, {
|
const response = await axios.post(`board/${currentBoardId.value}/comment`, {
|
||||||
LOCBRDSEQ: currentBoardId.value,
|
LOCBRDSEQ: currentBoardId.value,
|
||||||
@ -397,11 +397,11 @@ const handleCommentReply = async (reply) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 응답 데이터를 자세히 로그로 확인
|
// 응답 데이터를 자세히 로그로 확인
|
||||||
console.log('대댓글 작성 응답:', {
|
// console.log('대댓글 작성 응답:', {
|
||||||
status: response.status,
|
// status: response.status,
|
||||||
data: response.data,
|
// data: response.data,
|
||||||
headers: response.headers
|
// headers: response.headers
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
if (response.data.code === 200) { // 서버 응답 코드도 확인
|
if (response.data.code === 200) { // 서버 응답 코드도 확인
|
||||||
@ -439,7 +439,7 @@ const deleteClick = (unknown) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 댓글 수정 버튼 클릭
|
// 댓글 수정 버튼 클릭(대댓글 포함)
|
||||||
const editComment = (comment) => {
|
const editComment = (comment) => {
|
||||||
if (comment.isEditTextarea) {
|
if (comment.isEditTextarea) {
|
||||||
// 이미 수정창이 열려 있으면 닫기
|
// 이미 수정창이 열려 있으면 닫기
|
||||||
@ -465,7 +465,7 @@ const editComment = (comment) => {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 댓글 삭제 버튼 클릭
|
// 댓글 삭제 버튼 클릭(대댓글 포함)
|
||||||
const deleteComment = (comment) => {
|
const deleteComment = (comment) => {
|
||||||
if (unknown.value) {
|
if (unknown.value) {
|
||||||
if (comment.isEditTextarea) {
|
if (comment.isEditTextarea) {
|
||||||
@ -550,7 +550,7 @@ const submitPassword = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 댓글 비밀번호 제출
|
// 댓글 삭제 (비밀번호 확인 후)
|
||||||
const submitCommentPassword = async (comment, password) => {
|
const submitCommentPassword = async (comment, password) => {
|
||||||
if (!password) {
|
if (!password) {
|
||||||
passwordCommentAlert.value = "비밀번호를 입력해주세요.";
|
passwordCommentAlert.value = "비밀번호를 입력해주세요.";
|
||||||
@ -578,7 +578,7 @@ const submitCommentPassword = async (comment, password) => {
|
|||||||
passwordCommentAlert.value = "비밀번호가 일치하지 않습니다.";
|
passwordCommentAlert.value = "비밀번호가 일치하지 않습니다.";
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
passwordCommentAlert.value = "비밀번호 검증 중 오류가 발생했습니다.";
|
passwordCommentAlert.value = "비밀번호가 일치하지 않습니다";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -606,7 +606,7 @@ const deletePost = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 댓글 삭제
|
// 댓글 삭제 (대댓글 포함)
|
||||||
const deleteReplyComment = async (comment) => {
|
const deleteReplyComment = async (comment) => {
|
||||||
if (!confirm("정말 이 댓글을 삭제하시겠습니까?")) return;
|
if (!confirm("정말 이 댓글을 삭제하시겠습니까?")) return;
|
||||||
// console.log("댓글 ID:", comment);
|
// 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) => {
|
const handleSubmitEdit = async (comment, editedContent) => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.put(`board/comment/${comment.commentId}`, {
|
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) => {
|
const handlePageChange = (page) => {
|
||||||
if (page !== pagination.value.currentPage) {
|
if (page !== pagination.value.currentPage) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user