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';
5
5
import ClassNames from ' embla-carousel-class-names' ;
6
6
7
7
const { $directus, $readItem } = useNuxtApp ();
8
+
8
9
const props = defineProps <{ uuid: string }>();
9
- const block = ref <{ cards: Array <{ block_carousel_cards_id: string }> } | null >(null );
10
10
11
- const fetchSlides = async () => {
12
- const result = await $directus .request (
11
+ const { data : block } = useAsyncData ( ` carousel-${ props . uuid } ` , () =>
12
+ $directus .request (
13
13
$readItem (' block_carousel' , props .uuid , {
14
14
fields: [' id' , { cards: [' block_carousel_cards_id' ] }],
15
15
}),
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
+ );
24
18
</script >
25
19
26
20
<template >
You can’t perform that action at this time.
0 commit comments