diff --git a/src/components/article/ArticleList.vue b/src/components/article/ArticleList.vue index 6fe17ed..6f3fd85 100644 --- a/src/components/article/ArticleList.vue +++ b/src/components/article/ArticleList.vue @@ -1,18 +1,20 @@ diff --git a/src/components/article/CommentForm.vue b/src/components/article/CommentForm.vue index daebeb7..2462d4a 100644 --- a/src/components/article/CommentForm.vue +++ b/src/components/article/CommentForm.vue @@ -4,7 +4,8 @@ import FilledButton from '../common/FilledButton.vue'; import TextButton from '../common/TextButton.vue'; import { addComment } from '@/api/comment'; -const { id } = defineProps({ id: Number }); +const emit = defineEmits(['updateList']); +const { articleId } = defineProps({ articleId: Number }); const isActive = ref(false); const textDiv = ref(null); const text = ref(''); @@ -19,9 +20,8 @@ function handleCancel() { } function handleSubmit() { - addComment({ id, text: text.value }).then(({ data }) => { - console.log(data); - // TODO: 댓글 추가 후 처리 + addComment({ articleId, text: text.value }).then(({ data }) => { + emit('updateList', data); }); text.value = ''; isActive.value = false;