mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 07:26:59 +00:00
Adding 404 with Layout
This commit is contained in:
parent
5b2155a556
commit
7a9ed2ad91
35
pages/404.tsx
Normal file
35
pages/404.tsx
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import type { GetStaticPropsContext } from 'next'
|
||||||
|
import commerce from '@lib/api/commerce'
|
||||||
|
import { Layout } from '@components/common'
|
||||||
|
import { Text } from '@components/ui'
|
||||||
|
|
||||||
|
export async function getStaticProps({
|
||||||
|
preview,
|
||||||
|
locale,
|
||||||
|
locales,
|
||||||
|
}: GetStaticPropsContext) {
|
||||||
|
const config = { locale, locales }
|
||||||
|
const { pages } = await commerce.getAllPages({ config, preview })
|
||||||
|
const { categories, brands } = await commerce.getSiteInfo({ config, preview })
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
pages,
|
||||||
|
categories,
|
||||||
|
brands,
|
||||||
|
},
|
||||||
|
revalidate: 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function NotFound() {
|
||||||
|
return (
|
||||||
|
<div className="max-w-2xl mx-8 sm:mx-auto py-20 flex flex-col items-center justify-center fit">
|
||||||
|
<Text variant="heading">Not Found</Text>
|
||||||
|
<Text className="">
|
||||||
|
The requested page doesn't exist or you don't have access to it.
|
||||||
|
</Text>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
NotFound.Layout = Layout
|
Loading…
x
Reference in New Issue
Block a user