Utilizing the power of the WordPress Rest API as the backend for my project and Nuxt.js to handle the frontend, I am facing a challenge in retrieving data from pages using their ID/Slug since the pages are built with Gutenberg blocks. The issue at hand is that I'm only able to retrieve the first ID and have tried different approaches including mapping out the structure.
- Educational Resources/
- index.vue
- _slug.vue
export default {
async asyncData ({ app, store, params }) {
let page = await app.$axios.get(`${store.state.wordpressAPI}/wp/v2/pages?parent=77&_embed`)
store.commit('setPage', page.data[0])
},
computed: {
page () {
return this.$store.state.page
}
}
}