Skip to content

Instantly share code, notes, and snippets.

@patrickblackjr
Last active April 2, 2020 08:16
Show Gist options
  • Save patrickblackjr/acc900181e87afba113d0a0b3721eae3 to your computer and use it in GitHub Desktop.
Save patrickblackjr/acc900181e87afba113d0a0b3721eae3 to your computer and use it in GitHub Desktop.
Help lmao
generate: {
routes: async () => {
const { data } = await axios.post(
url,
JSON.stringify({
filter: { published: true },
sort: { _created: -1 },
populate: 1
}),
{
headers: { 'Content-Type': 'application/json' }
}
)
const collection = collect(data.entries)
const news = collection
.map(news => {
return {
route: news.title_slug,
payload: news
}
})
.all()
return news
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment