Added 404, error and test sender page

This commit is contained in:
MrFry 2020-03-15 13:42:21 +01:00
parent 214d15ef66
commit 49753aa113
3 changed files with 59 additions and 0 deletions

29
src/pages/_error.js Normal file
View file

@ -0,0 +1,29 @@
function Error ({ statusCode }) {
const render404 = () => {
return (
<center>
<h1>404</h1>
<iframe width='100%' height='465' src='https://www.youtube-nocookie.com/embed/GOzwOeONBhQ' frameborder='0' allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture' allowfullscreen />
</center>
)
}
if (statusCode === 404) {
return render404()
} else {
return (
<p>
{statusCode
? `An error ${statusCode} occurred on server`
: 'An error occurred on client'}
</p>
)
}
}
Error.getInitialProps = ({ res, err }) => {
const statusCode = res ? res.statusCode : err ? err.statusCode : 404
return { statusCode }
}
export default Error