import Link from 'next/link'
import { useRouter } from 'next/router'
export default function Page(props) {
const router = useRouter()
if (router.isFallback) return 'Loading...'
return (
<>
gsp page
{JSON.stringify(props)}
{router.locale}
{JSON.stringify(router.locales)}
{JSON.stringify(router.query)}
{router.pathname}
{router.asPath}
to /
>
)
}
export const getStaticProps = ({ params, locale, locales }) => {
// ensure getStaticProps isn't called without params
if (!params || !params.slug) {
throw new Error(`missing params ${JSON.stringify(params)}`)
}
if (locale === 'en' || locale === 'nl') {
return {
notFound: true,
}
}
return {
props: {
params,
locale,
locales,
},
}
}
export const getStaticPaths = () => {
return {
// the default locale will be used since one isn't defined here
paths: ['first', 'second'].map((slug) => ({
params: { slug },
})),
fallback: true,
}
}