I have this code:
createOrUpdate({
test: 'test'
}).then((response) => {
console.log(response);
});
which will expect a createOrUpdate to return a promise. Here is the createOrUpdate function:
function createOrUpdate(requestParams) {
var options = {};
return getService('global', function(error, serviceResult) {
if (error) {
log.error(error);
return callback(error, null);
}
//...
return requestPromise(options);
});
}
I have this getService method that takes some paramaters and a call back. I need to get that return requestPromise(options)
to return when createOrUpdate is called, but currently it is not working. I get an error saying I cannot call then on what createOrUpdate returns.
Ideas?