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

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

This commit is contained in:
Erik Nguyen 2018-12-18 16:45:36 +08:00 committed by Tim Neutkens
parent bd2dee21d4
commit cd0a1767f4

View file

@ -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 (