Skip to content

Commit

Permalink
refactor: await all at once
Browse files Browse the repository at this point in the history
  • Loading branch information
6lr61 committed Sep 18, 2024
1 parent 3183543 commit bb2f3b2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/utils/api/getBadges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,10 @@ export async function getBadges(
const url = new URL(CHANNEL_BADGES_URL);
url.searchParams.set("broadcaster_id", userId);

const channelBadges = await getBadgeSet(accessToken, clientId, url);
const globalBadges = await getBadgeSet(
accessToken,
clientId,
GLOBAL_BADGES_URL
);
const [channelBadges, globalBadges] = await Promise.all([
await getBadgeSet(accessToken, clientId, url),
await getBadgeSet(accessToken, clientId, GLOBAL_BADGES_URL),
]);

return [...globalBadges.data, ...channelBadges.data];
}

0 comments on commit bb2f3b2

Please sign in to comment.