Skip to content

Commit 9895439

Browse files
authored
Merge pull request #5101 from zooniverse/featured-project
Fetch featured project when not logged in
2 parents 24b3a2f + 06b59d9 commit 9895439

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/pages/home-not-logged-in.jsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default class HomePage extends React.Component {
2828
this.resizeTimeout = NaN;
2929
this.state = {
3030
count: 0,
31+
featuredProject: null,
3132
promotedProjects: [],
3233
screenWidth: 0,
3334
volunteerCount: 1500000
@@ -41,6 +42,7 @@ export default class HomePage extends React.Component {
4142
addEventListener('resize', this.handleResize);
4243
this.handleResize();
4344
this.getClassificationCounts();
45+
this.getFeaturedProject();
4446
this.getVolunteerCount();
4547
this.getPromotedProjects();
4648
}
@@ -49,6 +51,14 @@ export default class HomePage extends React.Component {
4951
removeEventListener('resize', this.handleResize);
5052
}
5153

54+
getFeaturedProject() {
55+
const query = { featured: true, launch_approved: true, cards: true };
56+
return apiClient.type('projects').get(query)
57+
.then(([featuredProject]) => {
58+
this.setState({ featuredProject });
59+
});
60+
}
61+
5262
getVolunteerCount() {
5363
apiClient.type('users').get({ page_size: 1 })
5464
.then(([user]) => {
@@ -128,7 +138,7 @@ export default class HomePage extends React.Component {
128138
</div>
129139

130140
<div className="flex-container">
131-
<FeaturedProject />
141+
<FeaturedProject project={this.state.featuredProject} />
132142
</div>
133143

134144
<div className="flex-container">

0 commit comments

Comments
 (0)