HI I have some code to get a json value from my db and then add it to an object but in my if cycle it has the value {"isRoot": "true", "visible": "true"}
but after the cycle i do a console.log to this and get undefined...
Database.Services.getServicesMapInfoById(device.id).then(function(mapData){
if(mapData!=undefined){
map = mapData.map;
console.log("sendDeviceInfo getServicesMapInfoById map >>>>>>>>>>>>>>>>>>>>> ", map);
console.log("sendDeviceInfo sendData.map >>>>> ", map);
console.log("end if ");
return resolve(map);
}
}).catch(function (e) {
createLog('error', __dirname, __filename.slice(__dirname.length + 1, -3), device.id, 'sendDeviceInfo','FATAL',e);
return reject(e);
});
console.log("sendDeviceInfo map --------------------------------->",map);
if(map!=null){
console.log("sendDeviceInfo map != null");
sendData.map=map;
}
Logs:
sendDeviceInfo getServicesMapInfoById map >>>>>>>>>>>>>>>>>>>>> {"isRoot": "true", "visible": "true"}
sendDeviceInfo map ---------------------------------> undefined
Can anyone help me? I'm returning the value of map with Promises using resolve but this didn't solve my problem...
via Catia Matos
No comments:
Post a Comment