Skip to content

Commit

Permalink
Add missing await for API request (#27676)
Browse files Browse the repository at this point in the history
`getAllPostsWithSlug` was missing an `await` on `fetchAPI`, resulting
in `data?.allPosts` always returning `undefined`. This meant SSG wasn't
aware of the paths it needed to generate.
  • Loading branch information
jameshoward authored Aug 2, 2021
1 parent 807d1ec commit 2cf58be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/cms-datocms/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function getPreviewPostBySlug(slug) {
}

export async function getAllPostsWithSlug() {
const data = fetchAPI(`
const data = await fetchAPI(`
{
allPosts {
slug
Expand Down

0 comments on commit 2cf58be

Please sign in to comment.