File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
components/Block/Carousel Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -5,22 +5,16 @@ import CarouselDots from '~/components/Carousel/CarouselDots.vue';
55import ClassNames from ' embla-carousel-class-names' ;
66
77const { $directus, $readItem } = useNuxtApp ();
8+
89const props = defineProps <{ uuid: string }>();
9- const block = ref <{ cards: Array <{ block_carousel_cards_id: string }> } | null >(null );
1010
11- const fetchSlides = async () => {
12- const result = await $directus .request (
11+ const { data : block } = useAsyncData ( ` carousel-${ props . uuid } ` , () =>
12+ $directus .request (
1313 $readItem (' block_carousel' , props .uuid , {
1414 fields: [' id' , { cards: [' block_carousel_cards_id' ] }],
1515 }),
16- );
17-
18- block .value = result as { cards: Array <{ block_carousel_cards_id: string }> };
19- };
20-
21- onMounted (async () => {
22- await fetchSlides ();
23- });
16+ ),
17+ );
2418 </script >
2519
2620<template >
You can’t perform that action at this time.
0 commit comments