Fix comment pagination and change show limit to 8 items
This commit is contained in:
@@ -19,7 +19,6 @@ const props = defineProps<Props>();
|
||||
const route = useRoute();
|
||||
|
||||
const id = route.params.id as string | undefined;
|
||||
const page = ref(1);
|
||||
|
||||
const { token } = useAuth();
|
||||
const userTitle = ref("");
|
||||
@@ -28,7 +27,7 @@ const selectedRating = ref(5);
|
||||
|
||||
const showMoreComments = ref(false);
|
||||
|
||||
const { data: comments, refetch: refetchComments } = useGetComments(id, page);
|
||||
const { data: comments, refetch: refetchComments } = useGetComments(id);
|
||||
const { mutateAsync: createComment, isPending: isCreateCommentPending } = useCreateComment(id);
|
||||
const { mutateAsync: rateProduct, isPending: isRateProductPending } = useRateProduct(props.product.slug);
|
||||
|
||||
@@ -209,10 +208,10 @@ const limitedComments = computed(() => {
|
||||
v-if="showMoreComments"
|
||||
:total="comments.count"
|
||||
:items="comments.results.map((item, i) => ({ type: 'page', value: i }))"
|
||||
:per-page="3"
|
||||
:per-page="8"
|
||||
/>
|
||||
<Button
|
||||
v-else
|
||||
v-else-if="comments.count > 3"
|
||||
type="button"
|
||||
variant="primary"
|
||||
@click="showMoreComments = !showMoreComments"
|
||||
|
||||
Reference in New Issue
Block a user