DEV Community

Discussion on: Build a blog with Nuxt, Contentful, Netlify and Tailwind

Collapse
 
thomas_ph35 profile image
Thomas

looks really nice ! I was about to do some stuff like this

I think asyncData can be used without async/await.
Also in you post you can set the language in 'code' markdown tag, so the code will be displayed with some colors :D

Collapse
 
vstothard profile image
Verity Stothard

Oh awesome, thank you! I'll have a look and ammend this later today :)

Collapse
 
vstothard profile image
Verity Stothard

Hey Thomas, I just revisited my code and you do need async/await on the asyncData method or the data caught in the stories variable below is a pending promise, causing the page to fail.

let blogPosts = await contentful.getEntries({ content_type: "blogPost" });

:)

Collapse
 
thomas_ph35 profile image
Thomas

yes ! I meant like this !
i'm pretty sure it would do the exact same thing :)

I use it that way with axios module.

Thread Thread
 
vstothard profile image
Verity Stothard

Ah gotcha! Thanks for the tip 👍