I'm trying to convert this simple function into a promise. I thought that resolve would take the place of the callback which returns function(err, value)
. What am I missing here?
var retrieveSet = function(offset){
var opts = {}
opts.limit = 100
if(offset) opts.offset = offset
return new Promise(function (resolve, reject) {
chargebee.subscription
.list(opts)
.request(resolve);
})
}
retrieveSet().then(function(data){
console.log(data)
}).catch(function(e){
throw e
})