set default value of comments array

This commit is contained in:
igoradamenko
2018-04-14 22:26:19 +03:00
parent 6b884d43b8
commit 29fb99ef63
+2 -1
View File
@@ -40,7 +40,8 @@ export default class Root extends Component {
.catch(() => store.set('user', {}))
.finally(() => {
api.find({ url })
.then(({ comments } = {}) => store.set('comments', comments))
.then(({ comments = [] } = {}) => store.set('comments', comments))
.catch(() => store.set('comments', []))
.finally(() => {
this.setState({
loaded: true,