errorProps.ts 289 B

123456789101112131415
  1. import { GetServerSidePropsContext } from "next/types";
  2. export default function errorProps(
  3. context: GetServerSidePropsContext,
  4. code = 404,
  5. otherProps: Docs = {}
  6. ) {
  7. context.res.statusCode = code;
  8. return {
  9. props: {
  10. statusCode: code,
  11. ...otherProps,
  12. },
  13. };
  14. }