mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
13 lines
363 B
TypeScript
13 lines
363 B
TypeScript
import { GetServerSidePropsContext } from 'next'
|
|
|
|
function Error({ statusCode }: { statusCode: number }) {
|
|
return <p>{statusCode ? `${statusCode} error` : '500 error'}</p>
|
|
}
|
|
|
|
export async function getServerSideProps({ res }: GetServerSidePropsContext) {
|
|
const statusCode = res ? res.statusCode : 404
|
|
return { props: { statusCode } }
|
|
}
|
|
|
|
export default Error
|