You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesi贸n a prueba de IA

Antes: $249

Currency
$209
Suscr铆bete

Termina en:

0 D铆as
7 Hrs
19 Min
59 Seg

Usando el m贸dulo HTTP para consumir nuestro backend

15/21
Resources

Contributions 1

Questions 0

Sort by:

Want to see more contributions, questions and answers from the community?

Si estas usando Nuxt 3, recomiendo usar useAsyncData.

Mi codigo:

<script setup>
    const articleContent = reactive({
        articles: [],
    })

    const url = 'http'+'://localhost:9999/.netlify/functions/articles'
// Desestructuramos data, y el proxy value, para obtener el proxy articles.
    const { data: {value: { articles }}} = await useAsyncData('articles', () => $fetch(url))
    
    onMounted(async () => {
        articleContent.articles = articles.map((a) => ({
            // Hacemos copia de los datos en a
            ...a,
            // Sobreescribimos author, date y cover.
            // Para tener un acceso m谩s directo a los datos.
            author: a['author-name'][0],
            date: new Date(a.updated),
            cover: a.cover[0]?.thumbnails.large.url,
        }))
    })
</script>

M谩s info: