I am trying to fetch posts with the following API:
const { api } = libraries.source;
const response = await api.get({
endpoint: "posts",
params: { _embed: true, per_page: 12, page: pageNumber },
});
But getting this error:
then I tried to use fetch from Frontity to set the header myself:
const response = await fetch(
`https://www.example.com/wp-json/wp/v2/posts/?_embed=true&page=${pageNumber}&per_page=12`,
{
method: "GET",
headers: {
"Access-Control-Allow-Origin": "*",
},
}
);
But this also results in the same error. Any help would be really appreciated, thanks!