Reputation: 53
Hello I am wondering if there are any syntax errors in the following code which would prevent the symbol, name, and price from pulling through:
if (command === 'getQuote') {
let getQuote = async () => {
let response = await axios.get(
'https://financialmodelingprep.com/api/v3/quote/AAPL?apikey=demo'
);
let quote = response.data
return quote
};
let quoteValue = await getQuote();
console.log(quoteValue);
message.reply(
`Heres your quote\n${quoteValue.symbol}\n\n${quoteValue.name}\n\n${quoteValue.price}`
);
}
Upvotes: 1
Views: 494
Reputation: 2076
It seems that you're getting an array back from the API, but you're treating the quoteValue
as an object instead.
Check this codesandbox:
https://codesandbox.io/s/infallible-dan-4nc4m?file=/src/index.js
Upvotes: 1