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:
parent
741f211331
commit
8578038daa
|
@ -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 }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue