NextJs and Strapi both explain how to pull data from a single collection type inside Strapi by doing this:
const pages = await (await fetch(getStrapiURL("/pages"))).json();
const paths = pages.map((page) => {
// Decompose the slug that was saved in Strapi
const slugArray = page.slug.split("__");
return {
params: { slug: slugArray },
};
});
return { paths, fallback: true };
}
Now my goal is to pull data from multiple collection types / pages: Here is my current code that I am using to do this:
export async function getStaticPaths() {
const [ pages, blogs ] = await Promise.all([
fetchAPI("/pages"),
fetchAPI("/blogs"),
]);
}
As you can see I have used a promise function to fetch multiple at the same time.
How do I map both these pages together in a map function