Second frontend, written in Next.JS + Typescript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
456 B

4 years ago
  1. import React from "react";
  2. interface ErrorPageProps {
  3. statusCode: number
  4. };
  5. export default function Error(props: ErrorPageProps) {
  6. return (
  7. <p>
  8. {props.statusCode
  9. ? `An error ${props.statusCode} occurred on server`
  10. : "An error occurred on client"}
  11. </p>
  12. )
  13. }
  14. export const getInitialProps = ({ res, err }) => {
  15. const statusCode = res ? res.statusCode : err ? err.statusCode : 404
  16. return { props: { statusCode } };
  17. };