|
|
|
@ -9,7 +9,7 @@ class App extends React.Component {
|
|
|
|
contacts: []
|
|
|
|
contacts: []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount = ()=>{
|
|
|
|
getPeople = ()=>{
|
|
|
|
axios
|
|
|
|
axios
|
|
|
|
.get('https://desolate-thicket-29906.herokuapp.com/api/contacts')
|
|
|
|
.get('https://desolate-thicket-29906.herokuapp.com/api/contacts')
|
|
|
|
.then((response)=>{
|
|
|
|
.then((response)=>{
|
|
|
|
@ -19,6 +19,10 @@ class App extends React.Component {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount = ()=>{
|
|
|
|
|
|
|
|
this.getPeople();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
createUser = (event)=>{
|
|
|
|
createUser = (event)=>{
|
|
|
|
event.preventDefault();
|
|
|
|
event.preventDefault();
|
|
|
|
axios
|
|
|
|
axios
|
|
|
|
@ -29,13 +33,7 @@ class App extends React.Component {
|
|
|
|
age:this.state.newPersonAge
|
|
|
|
age:this.state.newPersonAge
|
|
|
|
}
|
|
|
|
}
|
|
|
|
).then(()=>{
|
|
|
|
).then(()=>{
|
|
|
|
axios
|
|
|
|
this.getPeople();
|
|
|
|
.get('https://desolate-thicket-29906.herokuapp.com/api/contacts')
|
|
|
|
|
|
|
|
.then((response)=>{
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
contacts:response.data
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -60,7 +58,7 @@ class App extends React.Component {
|
|
|
|
<ul>
|
|
|
|
<ul>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.state.contacts.map((contact)=>{
|
|
|
|
this.state.contacts.map((contact)=>{
|
|
|
|
return <Person data={contact} />
|
|
|
|
return <Person refreshCallback={this.getPeople} data={contact} />
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
|
|
|