MCPcopy
hub / github.com/jamstack-cms/jamstack-ecommerce / getStaticProps

Function getStaticProps

pages/product/[name].js:84–94  ·  view source on GitHub ↗
({ params })

Source from the content-addressed store, hash-verified

82}
83
84export async function getStaticProps ({ params }) {
85 const name = params.name.replace(/-/g," ")
86 const inventory = await fetchInventory()
87 const product = inventory.find(item => slugify(item.name) === slugify(name))
88
89 return {
90 props: {
91 product,
92 }
93 }
94}
95
96function ItemViewWithContext(props) {
97 return (

Callers

nothing calls this directly

Calls 2

fetchInventoryFunction · 0.90
slugifyFunction · 0.90

Tested by

no test coverage detected