Fixed bug when loading article
When loading single article, site would fail
This commit is contained in:
parent
ef5aa853b7
commit
f5fbf78547
|
|
@ -24,7 +24,6 @@ class Articles extends React.Component {
|
||||||
|
|
||||||
|
|
||||||
const render = this.props.articles.map((article) => {
|
const render = this.props.articles.map((article) => {
|
||||||
console.log(article);
|
|
||||||
return (
|
return (
|
||||||
<Listing title={article.title} link={"/articles/"+article.id} key={article.id}>
|
<Listing title={article.title} link={"/articles/"+article.id} key={article.id}>
|
||||||
<div className="description">
|
<div className="description">
|
||||||
|
|
@ -42,8 +41,11 @@ class Articles extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
article(match) {
|
article(match) {
|
||||||
console.log(this.props.articles)
|
if (this.props.articles) {
|
||||||
return <Article article={this.props.articles[match.params.id]}/>;
|
return <Article article={this.props.articles[match.params.id]}/>;
|
||||||
|
} else {
|
||||||
|
return <div></div>;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue