mirror of
https://github.com/vercel/commerce.git
synced 2025-07-27 04:01:23 +00:00
updates
This commit is contained in:
@@ -1,21 +1,49 @@
|
||||
import pageTemplates from "components/agility-pageTemplates"
|
||||
import Head from 'next/head'
|
||||
|
||||
const AgilityPage = ({ agilityProps, error, revalidate }: { agilityProps: any, error?: any, revalidate?: any}) => {
|
||||
const AgilityPage = ({ agilityProps, error, revalidate }: { agilityProps: any, error?: any, revalidate?: any }) => {
|
||||
|
||||
if (!agilityProps) {
|
||||
console.error(`Page object or template was not found.`)
|
||||
return null
|
||||
}
|
||||
|
||||
let AgilityPageTemplate = pageTemplates(agilityProps.pageTemplateName)
|
||||
if (! AgilityPageTemplate) {
|
||||
console.error(`${agilityProps.pageTemplateName} not found.`)
|
||||
return null
|
||||
let pageTitle = "Commerce Storefront"
|
||||
|
||||
if (agilityProps.globalData?.sitedata) {
|
||||
pageTitle = agilityProps.globalData?.sitedata.name
|
||||
}
|
||||
|
||||
return (
|
||||
<AgilityPageTemplate {...agilityProps} />
|
||||
)
|
||||
if (agilityProps.notFound === true) {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Page Not Found - {pageTitle}</title>
|
||||
</Head>
|
||||
<div className="m-8 text-center" >Page not found.</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
if (agilityProps.pageTemplateName) {
|
||||
|
||||
let AgilityPageTemplate = pageTemplates(agilityProps.pageTemplateName)
|
||||
if (!AgilityPageTemplate) {
|
||||
console.error(`${agilityProps.pageTemplateName} not found.`)
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{agilityProps.sitemapNode?.title} - {pageTitle}</title>
|
||||
</Head>
|
||||
<AgilityPageTemplate {...agilityProps} />
|
||||
</>
|
||||
)
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user