diff --git a/components/errorDisplay/errorDisplay.js b/components/errorDisplay/errorDisplay.js index 7503724..9c80f66 100644 --- a/components/errorDisplay/errorDisplay.js +++ b/components/errorDisplay/errorDisplay.js @@ -2,6 +2,7 @@ export default function ErrorDisplay({error}){ return ( <>

{error.name}

+

{error.message}

) } diff --git a/components/header/header.js b/components/header/header.js index 3c8ac3e..1320836 100644 --- a/components/header/header.js +++ b/components/header/header.js @@ -33,7 +33,7 @@ const Header = () => { ):( <>
  • Account
  • - {user.admin &&
  • Admin
  • } + {user.is_admin &&
  • Admin
  • }
  • Log out
  • ) diff --git a/pages/_error.js b/pages/_error.js index 4fe03ae..b1e11c0 100644 --- a/pages/_error.js +++ b/pages/_error.js @@ -1,19 +1,17 @@ import React from 'react' import ErrorDisplay from '~/components/errorDisplay' -const ErrorPage = ({statusCode}) => ( - <> - - +const ErrorPage = ({error}) => ( + ) ErrorPage.getInitialProps = ({ res, err }) => { - let error = err; + let error = err || {}; if(!error) error = new Error('Server Error') - error.status = err.status || (res ? res.statusCode : (error.statusCode || 404)) + error.status = (err && err.status) || (res ? res.statusCode : (error.statusCode || 404)) return { error } }