I have boleto.js
var axios = require('axios');
function getBoleto (token) {
if (!token) throw Error('Miss Token!');
return axios.get(
'/boletos',
{
params: {
token: 'token...'
}
}
).then(res => {
//console.log(res.data);
return res.data;
})
.catch(err => {
console.log('Error boletos', err);
})
}
getBoleto()
.then(boletos => {
gravar(boletos, function(err){
if (err) throw new Error('Error boletos');
});
});
And gravar.js
module.exports = function (object, callback) {
// Save DB
...
console.log('Saved successfully');
callback();
}
What I need? Save the return of boleto.js in gravar.js
But brought this message : Reference error: gravar is not defined
via Diogo Barros
No comments:
Post a Comment