대댓글 수정중

This commit is contained in:
kimdaae328 2025-02-20 16:54:37 +09:00
parent 4440946c74
commit fdb2d81e53
4 changed files with 40 additions and 27 deletions

View File

@ -106,28 +106,12 @@ const submitComment = (newComment) => {
// ,
const handleUpdateReaction = (reactionData) => {
// console.log('📌 BoardComment.vue :', reactionData);
// if (!reactionData.commentId) {
// console.log(" reactionData.commentId ! null .");
// }
// console.log('🟢 BoardComment.vue props.comment:', props.comment);
// console.log('🟢 BoardComment.vue commentId:', props.comment.commentId);
// console.log('🔍 emit reactionData:', {
// boardId: props.comment.boardId,
// commentId: props.comment.commentId,
// ...reactionData
// });
emit('updateReaction', {
boardId: props.comment.boardId,
commentId: props.comment.commentId || reactionData.commentId, // reactionData commentId props.comment.commentId
commentId: props.comment.commentId || reactionData.commentId,
...reactionData,
});
// console.log('🚀 emit !');
};
//

View File

@ -79,9 +79,7 @@ const isCheck = ref(props.unknown);
const emit = defineEmits(['submitComment']);
watch(() => props.unknown, (newVal) => {
if (!newVal) {
isCheck.value = false;
}
isCheck.value = newVal;
});
function handleCommentSubmit() {

View File

@ -9,6 +9,7 @@
:unknown="unknown"
:comment="comment"
:isPassword="isPassword"
:isEditTextarea="isEditTextarea"
@editClick="editClick"
@deleteClick="deleteClick"
@submitPassword="submitPassword"
@ -37,6 +38,10 @@ const props = defineProps({
type: Boolean,
default: false,
},
isEditTextarea: {
type: Boolean,
default: false,
}
});
const emit = defineEmits(['submitComment', 'updateReaction', 'editClick']);

View File

@ -149,7 +149,7 @@ const authorId = ref(null); // 작성자 id
const isAuthor = computed(() => currentUserId.value === authorId.value);
const isEditTextarea = ref({});
const isEditTextarea = ref(false);
const password = ref('');
const passwordAlert = ref("");
@ -257,19 +257,22 @@ const handleCommentReaction = async ({ boardId, commentId, isLike, isDislike })
//
const fetchComments = async (page = 1) => {
try {
//
const response = await axios.get(`board/${currentBoardId.value}/comments`, {
params: {
LOCBRDSEQ: currentBoardId.value,
page
}
});
//
const replyResponse = await axios.get(`board/${currentBoardId.value}/reply`, {
params: { LOCBRDSEQ: currentBoardId.value }
params: {
LOCCMTPNT: 120
}
});
// console.log(":", response.data);
console.log("대댓글:", replyResponse.data);
console.log(replyResponse.data)
comments.value = response.data.data.list.map(comment => ({
commentId: comment.LOCCMTSEQ, // ID
@ -286,8 +289,6 @@ const fetchComments = async (page = 1) => {
children: [] //
}));
// console.log(" comments.value:", comments.value);
pagination.value = {
...pagination.value,
currentPage: response.data.data.pageNum, //
@ -310,6 +311,31 @@ const fetchComments = async (page = 1) => {
}
};
//
// const fetchReplies = async () => {
// try {
// const response = await axios.get(`board/${currentBoardId.value}/reply`);
// const replyData = response.data.data || [];
// return replyData.map(reply => ({
// commentId: reply.LOCCMTSEQ, // ID
// boardId: reply.LOCBRDSEQ,
// parentId: reply.LOCCMTPNT, // ID
// content: reply.LOCCMTRPY,
// createdAtRaw: new Date(reply.LOCCMTRDT), //
// createdAt: formattedDate(reply.LOCCMTRDT), //
// likeCount: reply.likeCount || 0,
// dislikeCount: reply.dislikeCount || 0,
// likeClicked: false,
// dislikeClicked: false
// }));
// } catch (error) {
// console.error(" :", error);
// return [];
// }
// };
//
const handleCommentSubmit = async ({ comment, password }) => {
try {