If we have multiple promises we could use Promise.all with await
async function asyncFunc() {
const response = await Promise.all([
axios.get("/some_url_endpoint"),
axios.get("/some_url_endpoint")
]);
...
}
error handling
async function asyncFunc() {
try {
// fetch data from a url endpoint
const data = await axios.get("/some_url_endpoint");
return data;
} catch(error) {
console.log("error", error);
// appropriately handle the error
}
}