Considering the example below:
function retornaValor (){
return promiseQueveioDeAlgumaLib.then(
function(oQueQueroRetornar){
return {
sucesso: true,
data : oQueQueroRetornar
}
},
function(opsAlgoErrado){
return {
sucesso : false,
data : opsAlgoErrado
}
}
)
}
console.log(retornaValor())
What should I do so that I actually have oQueQueroRetornar
or opsAlgoErrado
and not a Promise pending?
Just to note: when I write a code like this within Meteor.methods
it works exactly as I'd like, that is, it returns a value that is returned to the client, but out of methods
or in the client (browser, using or not any framework) the one I have is a Promise pending.