diff --git a/components/listings/singleStory.vue b/components/listings/singleStory.vue index 9e91c7a..a002d2b 100644 --- a/components/listings/singleStory.vue +++ b/components/listings/singleStory.vue @@ -10,12 +10,13 @@ const { token } = useToken(); const dark = inject>("dark"); const { data } = useAuth(); - let prop = defineProps<{ story: IStory; last?: boolean; showActions?: boolean }>(); - const idxo = (prop.last || false ? prop.story.chapters.length : 1) - 1; + const story = defineModel("story", { required: true }); + let prop = defineProps<{ last?: boolean; showActions?: boolean }>(); + const idxo = computed(() => (prop.last || false ? story.value.chapters.length : 1) - 1); // console.log("idx0->", idxo) // log.debug("posti->", prop.story.chapters[ prop.story.chapters.length - 1 ]); - const shortDate = format(Date.parse(prop.story.chapters[prop.story.chapters.length - 1]?.posted!.toString()), "yyyy/MM/dd"); - const longDate = format(Date.parse(prop.story.chapters[prop.story.chapters.length - 1]?.posted!.toString()), "iiii',' yyyy-MM-dd"); + const shortDate = format(Date.parse(story.value.chapters[story.value.chapters.length - 1]?.posted!.toString()), "yyyy/MM/dd"); + const longDate = format(Date.parse(story.value.chapters[story.value.chapters.length - 1]?.posted!.toString()), "iiii',' yyyy-MM-dd");