0

I have a "then" function where I declare a variable inside of it and return it. I console log the value inside of the "then" function and get a URL (https://...) but the value outside of the "then" is instead a "object Promise". See the code below

let url =  settings.CountryUrl().then(async (url) => {
    console.log("country url in QL " + url) // URL value
   urlcc = url
return urlcc = url
});


console.log(url) /// object Promise value

How do I get the value out of the "then" function (URL) and not the object promise? I cannot change the function "CountryUrl" since several other functions depend on it.

Arte2
  • 309
  • 4
  • 19

0 Answers0