I have two java-script function. In one function i have called another function. Its working fine. But the problem is first function not getting response from second function.
My Code.
class TestController {
static index(req, res) {
const localy = new TestController()
var checkCompanyChannel = localy._getCompanyChannel(params.cc, params.ff);
// var checkCompanyChannel = localy._getCompanyChannel(req, res);
// if(checkCompanyChannel.errno !== 200)
// return response.no('',checkCompanyChannel, res);
res.json(checkCompanyChannel);
res.end();
}
_getCompanyChannel(cc,ff){
var CcChannel = SequelizeS.CcChannel;
CcChannel.findOne({ where: {cc: cc, ff:ff} }).then(ccChannel => {
if(!ccChannel){
var out = {errno:500 , sqlMessage:'Data Not Found'};
return out;
}else{
var out = {errno:200 , sqlMessage:ccChannel};
return out;
}
}).catch(err => {
var out = {errno:500 , sqlMessage:err.errors};
return out;
});
}
}