I wanted to re-implemented the /news/-page on one of my frontity pages. So that’s why I created a handler and wanted to retrieve the news category at first (two later on query all the posts of that category):
export default {
priority: 10,
pattern: "/news1/",
func: async ({ route, params, state, libraries }) => {
const response = await libraries.source.api.get({
endpoint: "/wp/v2/categories/",
params: {
per_page: 100 // To make sure you get all of them
}
});
const items = response.json();
console.log(items)
const currentPageData = state.source.data[route];
Object.assign(currentPageData, {
items
});
},
}
But I am not gettting any results, from the API. Anyone got an idea what I am doing wrong?
Now, I have the problem that during the custom post listing I don’t have the attachments loaded, so I cannot display the featured_media. Any suggestions on how to fetch the attachments?