Skip to content
Snippets Groups Projects
Commit 268d565f authored by Thomas Roos's avatar Thomas Roos
Browse files

Working graders list

parent 8cfdd4e8
No related branches found
No related tags found
No related merge requests found
...@@ -8,24 +8,18 @@ class GraderList extends React.Component { ...@@ -8,24 +8,18 @@ class GraderList extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = {graders: [ this.state = {graders: [
{id: '1', name: 'John Doe'}, {id: '1', first_name: 'John', last_name: 'Doe'},
{id: '2', name: 'Jan Janssen'} {id: '2', first_name: 'Jan', last_name: 'Janssen'}
]}; ]};
} }
componentDidMount() { componentDidMount() {
fetch('/api/graders') fetch('/api/graders')
.then(function(response) { .then((response) => response.json())
return response.json() .then((graders) =>{
}) this.setState({graders: graders})
.then(function(json) { })
console.log(category, json)
this.setState(json);
})
.catch(function(error) {
console.log('error', error)
})
} }
...@@ -42,7 +36,7 @@ class GraderList extends React.Component { ...@@ -42,7 +36,7 @@ class GraderList extends React.Component {
</p> </p>
<ul className="menu-list"> <ul className="menu-list">
{this.state.graders.map(function(grader) { {this.state.graders.map(function(grader) {
return <li key={grader.id.toString()}>{grader.name}</li> return <li key={grader.id.toString()}>{grader.first_name + ' ' + grader.last_name}</li>
})} })}
</ul> </ul>
</aside> </aside>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment