after requesting the data in componentWillMount, after the setState operation of the obtained data, can you initiate the ajax request with the parameters in state in the setState callback and then retrieve the data setState
componentWillMount () {
let appId = this.GetQueryString("appId")
let language = this.GetQueryString("language")
axios.post("/api/language/findAll").then(res=>{
console.log("0000")
for(let i=0;i<res.length;iPP){
if(res[i].en==language){
this.setState({
language:res[i].pid,
appId:appId
},()=>{
this.queryConfig()
})
}
}
})
}
queryConfig () {
let params={
appId:this.state.appId,
lang:this.state.language
}
axios.post("/api/spirit/config",params).then(res=>{
console.log("")
this.setState({
custom:res.spirit.custom,
recommend:res.spirit.recommend,
strategy:res.spirit.strategy,
},()=>{console.log("")})
})
};