mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
Follow up to #27376 so users can disable keep-alive. See comment https://github.com/vercel/next.js/pull/27376#issuecomment-885415623
24 lines
500 B
JavaScript
24 lines
500 B
JavaScript
export default function Blog(props) {
|
|
return <pre id="props">{JSON.stringify(props)}</pre>
|
|
}
|
|
|
|
export async function getStaticProps({ params: { slug } }) {
|
|
return { props: { slug } }
|
|
}
|
|
|
|
export async function getStaticPaths() {
|
|
const res = await fetch('http://localhost:44001')
|
|
const obj = await res.json()
|
|
if (obj.connection === 'keep-alive') {
|
|
return {
|
|
paths: [{ params: { slug: 'first' } }],
|
|
fallback: false,
|
|
}
|
|
}
|
|
|
|
return {
|
|
paths: [],
|
|
fallback: false,
|
|
}
|
|
}
|