Ok, the problem is you cannot pass a value to emailStatus coming from the .then method:
I have encountered this problem before but I forgot how I got to the bottom of it. This post should help.
varemailStatus;// You cannot pass a value here_verifyEmail(User).then(asyncres=>{// Coming from here, the value inside this scope is only contained // inside this scope correct me if I'm wrong.emailStatus=awaitres;console.log(`res: ${res}`);});
I think there are two ways to solve this problem,
The first one requires you to add an async in _verifyUser:
The second one is a little bit experimental because i don't know if it will work:
Edit: Come to think of it this will not work, it will only return a promise I think.
I think you can just async await the callback.
I think you are the most intelligent person in the world.
I'll try this right away! Thanks!
Edit: unfortunately same result, it's still not working for some reason...
I think I have found the problem, you're console logging res instead of emailStatus.
I'm console logging both, but that's not the problem. The problem is that when _verifyEmail ends the result is a promise instead of an actual value.
Edit:
When I execute this code:
I get this as a result:
but _verifyUser should be a 400 (look at res) since there is already a user with the mail I've sent.
Ok, the problem is you cannot pass a value to emailStatus coming from the .then method:
I have encountered this problem before but I forgot how I got to the bottom of it.
This post should help.
I think there are two ways to solve this problem,
The first one requires you to add an async in _verifyUser:
The second one is a little bit experimental because i don't know if it will work:
Edit: Come to think of it this will not work, it will only return a promise I think.