From 7a9ed2ad9173284064a558e6fee930edf04056a6 Mon Sep 17 00:00:00 2001 From: Bel Curcio Date: Wed, 9 Jun 2021 12:22:03 -0300 Subject: [PATCH] Adding 404 with Layout --- pages/404.tsx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 pages/404.tsx diff --git a/pages/404.tsx b/pages/404.tsx new file mode 100644 index 000000000..bd085010f --- /dev/null +++ b/pages/404.tsx @@ -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 ( +
+ Not Found + + The requested page doesn't exist or you don't have access to it. + +
+ ) +} + +NotFound.Layout = Layout