In my site in frontity.settings.js I have set the postEndpoint
to be product
as that is the most important for me. However, how I am having some issues, and I am not sure what is the best way to solve it as I am still trying to get a grasp of wp-source.
So logically, now that I have postEndpoint set to product, when I visit the blog page, i can see my products instead of posts. I am wondering what would be the best way to fetch the posts when visiting the posts page(List component).
Should I do it in useEffect()
or do I use a handler?
Any help would be appreciated.
Here are my settings of wp-source:
{
name: "@frontity/wp-source",
state: {
source: {
api: "https://kh-api.whaledev.com/wp-json/",
params: {
per_page: 20,
},
homepage: "/home/",
postsPage: "/blog/",
postEndpoint: "product",
postTypes: [
{
type: "post",
endpoint: "post",
archive: "/post",
},
{
type: "product",
endpoint: "product",
archive: "/product",
},
{
type: "media",
endpoint: "media",
archive: "/media",
},
{
type: "page",
endpoint: "page",
},
],
},
},
},