Basic config and layout for fetching, showing wp data with graphql

This commit is contained in:
Moris Zen
2018-06-25 10:53:58 +02:00
parent 57f717fec0
commit d145e29086
6 changed files with 111 additions and 1 deletions

View File

@@ -17,6 +17,20 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
}
}
`
)
).then(result => {
if (result.errors) {
console.log(result.errors)
reject(result.errors)
}
result.data.allWordpressPage.edges.forEach(({ node }) => {
createPage({
path: node.slug,
component: path.resolve('./src/pages/page.js'),
})
})
resolve()
})
})
}