ecommerce_sanity_stripe
ecommerce_sanity_stripe copied to clipboard
Products not showing up error
I am getting this message when first hooking up sanity, it is not pulling up the products I have created with sanity.
did you give it a prop
As @marvelous-007 have suggested, you might have forgotten to pass in the products prop in your getServerSideProps
function.
// Get Server Side Props: https://nextjs.org/docs/pages/building-your-application/data-fetching/get-server-side-props
export const getServerSideProps = async () => {
// Sanity Query for Products
const product_query = '*[_type == "product"]';
const products = await client.fetch(product_query);
// Sanity Query for Banner
const banner_query = '*[_type == "banner"]';
const banner = await client.fetch(banner_query);
return {
props: { products, banner },
};
};
props: {products, banner}
is where you want to check for this mistake.
Hope this helps :)