async function generate_stock_data() {
await Promise.all([
// api related to low(l) high(h) open(o) current(c)
await fetch(`https://finnhub.io/api/v1/stock/profile2?symbol=AAPL&token=${STOCK_API_KEY}`)
// company information
, await fetch(`https://finnhub.io/api/v1/quote?symbol=AAPL&token=${STOCK_API_KEY}`)
])
.then(async function (responses) {
console.log("here");
// return Promise.all(responses.map(function (response) {
// return response.json();
// }));
let resultJson = [];
for (let i = 0; i < responses.length; i++) {
resultJson[i] = await responses[i].json();
}
return resultJson;
}).then(data => {
console.log(data);
}).catch(error => console.log(error));
}

async function generate_stock_data() {
try {
const responses = await Promise.all([
// api related to low(l) high(h) open(o) current(c)
fetch(`https://finnhub.io/api/v1/stock/profile2?symbol=AAPL&token=${STOCK_API_KEY}`)
// company information
, fetch(`https://finnhub.io/api/v1/quote?symbol=AAPL&token=${STOCK_API_KEY}`)
])
console.log("here");
// return Promise.all(responses.map(function (response) {
// return response.json();
// }));
let resultJson = [];
for (let i = 0; i < responses.length; i++) {
resultJson[i] = responses[i].json();
}
console.log(resultJson);
} catch (e) {
console.log(e);
}
}

뭐 이런식으로 해서 써라
async/await 해놓고 왜 then/catch랑 썪어서 쓰냐