I am trying to return a value from a promise but whatever I try, I always end up returning a new promise
let query = URL
let result = Fetch.fetch(query)
->then(balance => resolve(Ok(balance->Belt.Float.fromString)))
->catch(err => reject(err))
(I am using bs-fetch)
I tried different combinations but result is always a promise when I want it to be result<float, string>. All the examples I could find online finish with ->ignore or return a promise.
How can I break the chain of promises and return the float value I get from calling the URL?