这是我的代码,其中我在将用户ID传递给api时调用api
updateNameApiCall(){
ls.get("savedata").then(data => {this.setState({ userId: data.user.id },()=>{
let passUserId=this.state.userId;
axios.post("http://172.104.217.178/blaze10/public/api/update_name/"+passUserId+{
name:this.state.updateName,
})
.then((response) => {
alert(JSON.stringify(response));
// this.setState({name1:this.state.updateName
// });
})
.catch(error => alert(JSON.stringify(error)));
})})
}