提交 98b48fb3 编写于 作者: R Remy Sharp 提交者: Tim Neutkens

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.
上级 c0eca358
......@@ -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 }
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册