대댓글

This commit is contained in:
kimdaae328 2025-02-20 16:57:27 +09:00
parent fdb2d81e53
commit a21bf8f6a1

View File

@ -266,15 +266,15 @@ const fetchComments = async (page = 1) => {
});
//
const replyResponse = await axios.get(`board/${currentBoardId.value}/reply`, {
params: {
LOCCMTPNT: 120
}
});
// const replyResponse = await axios.get(`board/${currentBoardId.value}/reply`, {
// params: {
// LOCCMTPNT: 120
// }
// });
console.log(replyResponse.data)
// console.log(replyResponse.data)
comments.value = response.data.data.list.map(comment => ({
const commentsList = response.data.data.list.map(comment => ({
commentId: comment.LOCCMTSEQ, // ID
boardId: comment.LOCBRDSEQ,
parentId: comment.LOCCMTPNT, // ID
@ -289,6 +289,25 @@ const fetchComments = async (page = 1) => {
children: [] //
}));
for (const comment of commentsList) {
//
const replyResponse = await axios.get(`board/${currentBoardId.value}/reply`, {
params: {
LOCCMTPNT: comment.parentId // ID
}
});
console.log(`댓글 ${comment.parentId}의 대댓글:`, replyResponse.data);
// children
if (replyResponse.data.data) {
comment.children = replyResponse.data.data;
}
}
//
comments.value = commentsList;
pagination.value = {
...pagination.value,
currentPage: response.data.data.pageNum, //