Skip to content

Commit

Permalink
Get all ProjectContents for a project
Browse files Browse the repository at this point in the history
Only display the first for now.
  • Loading branch information
eatyourgreens committed May 26, 2017
1 parent 3d7f0c6 commit d98ad5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/components/ProjectContents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ options.log = (test) => {
class ProjectContents extends Component {
render() {
const { contents } = this.props;
const data = contents.data;
const project_contents = contents.data.length ? contents.data[0] : {};
return (
<div>
<h2>Project Contents</h2>
<p>Title: { data.title }</p>
<p>Description: { data.description }</p>
<p>Introduction: { data.introduction }</p>
<p>Language: { data.language}</p>
<p>Title: { project_contents.title }</p>
<p>Description: { project_contents.description }</p>
<p>Introduction: { project_contents.introduction }</p>
<p>Language: { project_contents.language}</p>
</div>
);
}
Expand Down
5 changes: 4 additions & 1 deletion src/ducks/contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ const fetchProjectContents = (project_id) => {
dispatch({
type: FETCH_PROJECT_CONTENTS,
});
apiClient.type('project_contents').get(project_id)
const query = {
project_id: project_id
}
apiClient.type('project_contents').get(query)
.then((projectContents) => {
dispatch({
type: FETCH_PROJECT_CONTENTS_SUCCESS,
Expand Down

0 comments on commit d98ad5b

Please sign in to comment.