Access return value inside a nested if else in .then() Promise in javascript with axios


How can I access the function return value that is within inside .then() promise in javascript

 const verification = () => {

twil.verificationChecks.create({to:phone, code:vcode}).then( (verify) => { otp = verify.status;          //twilio  
  // console.log(otp);
  const user = finduser;
  if(otp === "approved"){                                  // otp approved
     
    if(user){                                         //check phone
   find();             //find user
   return "user found"
    }
    else{
      add();           //add user
     return "user added"
      
    }                                               //check phone
     
  }                                                       // otp approved
   
} 
  );
  
} 

Source: JavaSript – Stack Overflow

November 13, 2021
Category : News
Tags: javascript | mongodb | mongodb-realm | node.js | twilio

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.