next/components/reviews/forChapter.vue

18 lines
567 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>