Fix: Fix comment area

This commit is contained in:
jhynsoo 2024-05-23 17:12:31 +09:00
parent 486db7b781
commit 4825289175
3 changed files with 3 additions and 4 deletions

View File

@ -20,7 +20,7 @@ function updateList(comment) {
댓글 <span>{{ comments.length }}</span>
</h2>
<CommentForm @updateList="updateList" :article-id="articleId" v-if="memberStore.isLogin" />
<CommentList :comments="comments" />
<CommentList :comments="comments" :userId="memberStore.userId" />
</div>
</template>

View File

@ -1,9 +1,7 @@
<script setup>
import { useMemberStore } from '@/stores/memberStore';
import CommentItem from './CommentItem.vue';
const { comments } = defineProps({ comments: Array });
const { userId } = useMemberStore();
const { comments, userId } = defineProps({ comments: Array, userId: String });
</script>
<template>

View File

@ -9,6 +9,7 @@ export const useMemberStore = defineStore('memberStore', () => {
const accessToken = ref(localStorage.getItem('accessToken'));
const isLogin = computed(() => accessToken.value !== null);
const userId = computed(() => {
if (!isLogin.value) return null;
return jwtDecode(accessToken.value).userId;
});