diff --git a/frontend/components/product/ProductComments.vue b/frontend/components/product/ProductComments.vue index 9137445..9daa392 100644 --- a/frontend/components/product/ProductComments.vue +++ b/frontend/components/product/ProductComments.vue @@ -5,6 +5,7 @@ import useGetComments from "~/composables/api/product/useGetComments"; import useCreateComment from "~/composables/api/product/useCreateComment"; import useRateProduct from "~/composables/api/product/useRateProduct"; import { useAuth } from "~/composables/api/auth/useAuth"; +import useGetProduct from "~/composables/api/product/useGetProduct"; // props @@ -28,6 +29,7 @@ const selectedRating = ref(5); const showMoreComments = ref(false); const { data: comments, refetch: refetchComments } = useGetComments(id); +const { refetch: refetchProduct } = useGetProduct(id); const { mutateAsync: createComment, isPending: isCreateCommentPending } = useCreateComment(id); const { mutateAsync: rateProduct, isPending: isRateProductPending } = useRateProduct(props.product.slug); @@ -80,6 +82,7 @@ const submitComment = async () => { userComment.value = ""; selectedRating.value = 5; + await refetchProduct(); await refetchComments(); }; @@ -112,61 +115,66 @@ const limitedComments = computed(() => { @submit.prevent="submitComment" class="flex flex-col gap-6" > -