From 3dc1c2327f1a4309e0f55215650fd0c73bebe18d Mon Sep 17 00:00:00 2001 From: Carlo Beltrame Date: Sat, 13 Apr 2024 16:54:46 +0200 Subject: [PATCH] Fix useAsyncData call --- print/components/story/StoryPeriod.vue | 43 ++++++++++++++------------ 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/print/components/story/StoryPeriod.vue b/print/components/story/StoryPeriod.vue index b121da1f1a..0f8f65f0be 100644 --- a/print/components/story/StoryPeriod.vue +++ b/print/components/story/StoryPeriod.vue @@ -30,27 +30,30 @@ const props = defineProps({ const { $api } = useNuxtApp() -const { data, error } = await useAsyncData('StoryPeriod', async () => { - const contentTypeStorycontext = ( - await $api.get().contentTypes().$loadItems() - ).items.find((contentType) => contentType.name === 'Storycontext') +const { data, error } = await useAsyncData( + `StoryPeriod-${props.period._meta.self}`, + async () => { + const contentTypeStorycontext = ( + await $api.get().contentTypes().$loadItems() + ).items.find((contentType) => contentType.name === 'Storycontext') - const [periodStoryChapters] = await Promise.all([ - $api - .get() - .contentNodes({ - period: props.period._meta.self, - contentType: contentTypeStorycontext._meta.self, - }) - .$loadItems(), - props.period.days().$loadItems(), - props.period.scheduleEntries().$loadItems(), - props.period.camp().categories().$loadItems(), - ]) + const [periodStoryChapters] = await Promise.all([ + $api + .get() + .contentNodes({ + period: props.period._meta.self, + contentType: contentTypeStorycontext._meta.self, + }) + .$loadItems(), + props.period.days().$loadItems(), + props.period.scheduleEntries().$loadItems(), + props.period.camp().categories().$loadItems(), + ]) - return { - days: props.period.days().items, - periodStoryChapters: periodStoryChapters.items, + return { + days: props.period.days().items, + periodStoryChapters: periodStoryChapters.items, + } } -}) +)