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:
parent
bd2dee21d4
commit
cd0a1767f4
|
@ -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 (
|
||||
|
|
Loading…
Reference in a new issue