var got = require('got')
exports.coger = function (id){
let i;
if (!id){
i = "Introduzca una id";
return i;
}
got('enlace privado').then(f => {
let a = JSON.parse(f.body)
console.log(a)
if(a.error){
i = a.error
return i;
}
i ={"usuario":a.usuario,"id":a.id,"descripcion":a.descripcion,"fecha":a.fecha,"multicuentas":a.multicuentas}
return i;
})
}
I have also tried to put the return i
; out of}} but still giving undefined
everything works fine except the ending since doing return i
; it tells me undefined
instead of object i