File size: 572 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import { draftMode } from 'next/headers'
export default async function Page() {
const data = await fetch(
'https://next-data-api-endpoint.vercel.app/api/random'
).then((res) => res.text())
const { isEnabled } = await draftMode()
return (
<main>
<pre id="draft-mode">{JSON.stringify({ isEnabled })}</pre>
<p id="data">{data}</p>
</main>
)
}
export const generateStaticParams = async () => {
const paths = [
{
route: [],
},
{
route: ['test'],
},
{
route: ['test-2'],
},
]
return paths
}
|