Skip to content

Commit

Permalink
toujours rien
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu777 committed Apr 7, 2021
2 parents 8f17028 + 409f8c1 commit 2180196
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .eslintcache

Large diffs are not rendered by default.

25 changes: 24 additions & 1 deletion src/barre-gauche.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,29 @@ import rockets from './image/rockets.png'


export default class barregauche extends Component {

constructor(props) {
super(props)
this.state = {
firstFriend:""
};
}

componentDidMount(){
fetch('http://localhost:4000/app/friendlist', {
method: 'GET',
// credentials : include permet d'intégrer les cookie avec la requête
credentials: 'include',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
})
.then(response => response.json())
.then(response => {
this.setState({firstFriend:response.firstFriend})
})
}
render(){
return(
<div>
Expand All @@ -18,7 +41,7 @@ export default class barregauche extends Component {
<img className="profil" src={profil} alt="photo de profil"/>
</div>
<div className="bouton-part ">
<Link to={'/app2/'+this.props.firstFriend}>
<Link to={'/app2/'+this.state.firstFriend}>
<img className="logo-message" src={envelope} alt="message"/>
</Link>
<Link to='/app/friendlist'>
Expand Down

0 comments on commit 2180196

Please sign in to comment.