댓글 사용자 좋아요 싫어요 상태 업데이트

This commit is contained in:
nevermoregb 2025-03-28 13:08:21 +09:00
parent 3f8718831f
commit ad4bcb511f
2 changed files with 11 additions and 4 deletions

View File

@ -33,13 +33,20 @@
</template>
<!-- 좋아요, 싫어요 버튼 (댓글에서만 표시) -->
<BoardRecommendBtn v-if="isLike && !isDeletedComment" :boardId="boardId" :comment="comment" @updateReaction="handleUpdateReaction" />
<BoardRecommendBtn
v-if="isLike && !isDeletedComment"
:boardId="boardId"
:comment="comment"
:likeClicked="comment.likeClicked"
:dislikeClicked="comment.dislikeClicked"
@updateReaction="handleUpdateReaction"
/>
</div>
</div>
</template>
<script setup>
import { computed, defineProps, defineEmits, inject } from 'vue';
import { computed, defineProps, defineEmits, inject, onMounted } from 'vue';
import DeleteButton from '../button/DeleteBtn.vue';
import EditButton from '../button/EditBtn.vue';
import BoardRecommendBtn from '../button/BoardRecommendBtn.vue';

View File

@ -341,8 +341,6 @@
dislikeCount: comment.dislikeCount || 0,
profileImg: comment.profileImg || '',
nickname: comment.LOCCMTNIC || '',
likeClicked: comment.likeClicked || false,
dislikeClicked: comment.dislikeClicked || false,
createdAtRaw: comment.LOCCMTRDT, //
// createdAt: formattedDate(comment.LOCCMTRDT), // ()
// createdAtRaw: new Date(comment.LOCCMTUDT), //
@ -351,6 +349,8 @@
(comment.content === '삭제된 댓글입니다' && comment.LOCCMTUDT !== comment.LOCCMTRDT ? ' (수정됨)' : ''), // ()
children: [], //
updateAtRaw: comment.LOCCMTUDT,
likeClicked: comment.myReaction == 1,
dislikeClicked: comment.myReaction == 2,
}))
.sort((a, b) => b.createdAtRaw - a.createdAtRaw);