Answer the question
In order to leave comments, you need to log in
How can this be predicted?
const onSuccess = data => console.log(data)
const
onFailure
=
error
=> console.error(error) (onSuccess).catch(onFailure )
ps already tried promisify, promisifyAll from bluebird, doesn't work. As I understand it, bluebird will promisify the callback api if it is a node style callback api
Answer the question
In order to leave comments, you need to log in
Something like that:
cognitoUser.prototype.authenticateUserPromise = function (authenticationDetails) {
return new Promise((resolve, reject) => {
this.authenticateUser(authenticationDetails, (result)=>{return resolve(result)}, (error) =>{return reject(error)});
});
If I understand correctly, then you need to try this:
Promise.resolve(() => cognitoUser.authenticateUser(authenticationDetails)).then(onSuccess).catch(onFailure )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question