javascript - Promises are not working in componentDidMount -


i new react.js. in componentdidmount function, calling 4 functions parallelly using q module. in every function, making api. once got responses 4 services,i want trigger 1 more function. have written following logic.

var q=require("q");  componentdidmount: function () {     var self=this;     this.setstate({loader:true});     q.all([this.getsegmentinfo(),this.getsignedurl(),this.getoverrallmyntrametricinfo(),this.getsegmentmetricinfo()]).then(         function(result){             self.makedataformetrics();         },function(error){             utils.togglemessage(true,"sorry services failed.. try again","verror");         }     ); }  

the problem was, after got response services. dependent callback not triggering.

all parallel functions looks like

getsignedurl:function(){   var promiseinfo1=q.defer();   //making service using ajax   return promiseinfo1.promise;       } 

can me, why dependent function not triggering.

thanks.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -