提交 cd0a1767 编写于 作者: E Erik Nguyen 提交者: Tim Neutkens

change errorCode prop name for clearer explanation of code example (#5914)

上级 bd2dee21
......@@ -1196,15 +1196,15 @@ import fetch from 'isomorphic-unfetch'
export default class Page extends React.Component {
static async getInitialProps() {
const res = await fetch('https://api.github.com/repos/zeit/next.js')
const statusCode = res.statusCode > 200 ? res.statusCode : false
const errorCode = res.statusCode > 200 ? res.statusCode : false
const json = await res.json()
return { statusCode, stars: json.stargazers_count }
return { errorCode, stars: json.stargazers_count }
}
render() {
if (this.props.statusCode) {
return <Error statusCode={this.props.statusCode} />
if (this.props.errorCode) {
return <Error statusCode={this.props.errorCode} />
}
return (
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册