3. Coordinating Several Async Calls
javascript
async function loadDashboardBundle() {
try {
// Sequential fetches
const account = await fetchAccount();
const orders = await fetchOrders(account.id);
// Parallel fetches
const [notes, labels] = await Promise.all([
fetchNotes(orders[0].id),
fetchLabels(orders[0].id)
]);
return { account, orders, notes, labels };
} catch (failure) {
console.error('Failed in loadDashboardBundle:', failure);
// Return default values or re-throw
return null;
}
}