mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-26 17:16:11 -05:00
Merge pull request #106 from mewtaylor/feature/project-count-from-api
Get project count from api when logged out
This commit is contained in:
commit
20a3efcbf4
2 changed files with 11 additions and 0 deletions
|
@ -3,6 +3,7 @@ var React = require('react');
|
|||
var ReactIntl = require('react-intl');
|
||||
var FormattedMessage = ReactIntl.FormattedMessage;
|
||||
var FormattedHTMLMessage = ReactIntl.FormattedHTMLMessage;
|
||||
|
||||
var Modal = require('../modal/modal.jsx');
|
||||
|
||||
require('./intro.scss');
|
||||
|
|
|
@ -52,6 +52,7 @@ var Splash = injectIntl(React.createClass({
|
|||
this.getNews();
|
||||
} else {
|
||||
this.setState({featuredCustom: []});
|
||||
this.getProjectCount();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -61,6 +62,8 @@ var Splash = injectIntl(React.createClass({
|
|||
this.getActivity();
|
||||
this.getCustomHomepageRows();
|
||||
this.getNews();
|
||||
} else {
|
||||
this.getProjectCount();
|
||||
}
|
||||
},
|
||||
getNews: function () {
|
||||
|
@ -77,6 +80,13 @@ var Splash = injectIntl(React.createClass({
|
|||
if (!err) this.setState({'activity': body});
|
||||
}.bind(this));
|
||||
},
|
||||
getProjectCount: function () {
|
||||
this.api({
|
||||
uri: '/projects/count/all'
|
||||
}, function (err, body) {
|
||||
if (!err) this.setState({projectCount: body.count});
|
||||
}.bind(this));
|
||||
},
|
||||
renderHomepageRows: function () {
|
||||
var formatMessage = this.props.intl.formatMessage;
|
||||
var rows = [
|
||||
|
|
Loading…
Reference in a new issue