Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Using async/await or then in typescript (React-Native) but not getting any result

$
0
0

Here is code block where i am calling an axios call and promise is not resolving.I am using typescript here , version of typescript is 4

getBalance = async (address: string) => {      let endpoints = this.getBalanceEndpoint();      for (let i = 0; i < endpoints.length; i++) {        let endpoint = endpoints[i];        const url = endpoint + address +'?details=basic';        const param: object = {          method: 'get',          url: url,          headers: {'User-Agent': UA,          },          timeout: 1000,        };        try {          console.log(param,"Balance Params")          **const response = await axios(param)**;          console.log(response,"BITCOIN BALANCE")          }        } catch (e) {          console.log(e)        }        await new Promise(resolve =>          setTimeout(resolve, GENERIC_REQUEST_THROTTLE_DELAY)        );      }      throw new Error('Unable to retrieve balance!');    };  ```I am not getting any result or promise is not resolving in await axios call.Please let me know answer

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>