0

I want this function return true/false. But it does not. It returns undefined. Could you please help me.

function isAvailable() {

  let startTime = new Date();
  let isAvail = null;
  Functions.getContentFromUrl(webLink + "/health-checker")
    .then((html) => {
      if (html.includes('Good!')) {
        isAvail=true;
      }
      else {
        console.error("Server is not available:" + html);
        isAvail =false;
      }


    })
    .catch((err) => {
        console.error("this is error" + err);
        isAvail =false;


      }
    )
  return isAvail;
  ;
}
Mike
  • 83
  • 8

0 Answers0