I do an axios get(url + this.state.user) but the parameter is undefined for no reason because when i do a console log of the parameter it exists...
My code
state = {
user: [],
taches : [],
loading: false
}
componentDidMount = () => {
this.setState({loading:true})
axios.get('/get-user').then(response => {
this.setState({user : response.data});
}).catch(error => {
console.log(error);
})
axios.get('/get-taches/' + this.state.user.ID_Users).then(response => {
console.log(this.state.user.ID_Users);
}).catch(error => {
console.log(this.state.user.ID_Users);
console.log(error);
})
}
The parameter of axios get-taches return undefined but when i do a console log of it in the catch error it is defined and it shows in the console... I dont know where the problem is.
Thank you for your help