1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Change _error.js example to use err prop (#3197)

The `jsonPageRes` isn't always there, whereas `err` is, and when used,
provides a consistent statusCode in the client when compared to the
server.
This commit is contained in:
Remy Sharp 2017-10-28 08:23:15 +01:00 committed by Tim Neutkens
parent c0eca35810
commit 98b48fb3ec

View file

@ -849,10 +849,8 @@ __Note: React-components outside of `<Main />` will not be initialised by the br
import React from 'react'
export default class Error extends React.Component {
static getInitialProps({ res, jsonPageRes }) {
const statusCode = res
? res.statusCode
: jsonPageRes ? jsonPageRes.status : null
static getInitialProps({ res, err }) {
const statusCode = res ? res.statusCode : err ? err.statusCode : null;
return { statusCode }
}