In console debug Unable to display objData details? I am using fetch() method to get details from external services. Getting error in console Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'log') at eval (lwcCallOut.js:1:2652)
js File >>>>
handleClick() {
fetch('https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=' + this.FromCurrencyValue +
'&to_currency=' + this.ToCurrencyValue + '&apikey=T8P8FQ9JP56SWT0L', {
method: "GET",
headers: {
"Content-type": "application/json",
"Authorization": "OAuth 00D5g00000EIV0z!AR8AQFf0J3ZQF9HU3TOcJGd1o3Nj6oLj6bQyJX0wgs2rwubv90cBy4ZX4fZJb0c07lCKmLEcnV4EsRUexzRf31mTEaFVf6Tr"
}
})
.then((response) => {
return response.json();
})
.then((jsonResponse) => {
let objData = {
From_Currency_Name: '',
From_Currency_Code: '',
To_Currency_Name: '',
To_Currency_Code: '',
Last_RefreshId: '',
Exchange_Rate: '',
};
window.console.log('Get JSON Response is >>>' + JSON.stringify(jsonResponse));
let exchangeData = jsonResponse['Realtime Currency Exchange Rate'];
console.log('exchangeData >>>>>' + JSON.stringify(exchangeData));
objData.From_Currency_Name = exchangeData['1. From_Currency Code'];
objData.From_Currency_Code = exchangeData['2. From_Currency Name'];
objData.To_Currency_Name = exchangeData['4. To_Currency Name'];
objData.To_Currency_Code = exchangeData['3. To_Currency Code'];
objData.Exchange_Rate = exchangeData['5. Exchange Rate'];
objData.Last_RefreshId = exchangeData['6. Last Refreshed'];
Window.console.log("objData >>>>>>" + JSON.stringify(objData));
})
}