I'm trying to create a method, and in another method to access its return. However, when I don't return anything, the promise gives the error: then is not a function.
verifyUser() {
if (currentUser.Title) {
return Promise.resolve(currentUser)
}
}
myMethod() {
this.verifyUser
.then(user => {
console.log(user);
})
}
When nothing returns, I tried to catch it, but it didn't work either
However, when I don't return anything, the promise gives the error: then is not a function.Which promise? When you don't return anything, there is no promise to callthenon.verifyUserdo in the case whencurrentUserdoes not haveTitle. Throw an error, returnnull, … ?