Last active
April 2, 2020 08:16
-
-
Save patrickblackjr/acc900181e87afba113d0a0b3721eae3 to your computer and use it in GitHub Desktop.
Help lmao
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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