next/components/reviews/forChapter.vue

16 lines
561 B
Vue

<script lang="ts" setup>
import { IReview } from "@models/stories/review";
import singleReview from "./singleReview.vue";
import { SingleChapterResult } from "@client/types/slightlyDifferentStory";
const props = defineProps<{ endpoint: string }>();
const story = inject<SingleChapterResult>("story");
const { data: reviews } = (await useApiFetch<IReview[]>(`${props.endpoint}/reviews`)) as unknown as {
data: IReview[];
};
</script>
<template>
<div v-for="comment in reviews">
<single-review :review="comment" :story="story!" />
</div>
</template>