aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/utils/users.ts14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/utils/users.ts b/src/utils/users.ts
index e11e8c78..f54d461c 100644
--- a/src/utils/users.ts
+++ b/src/utils/users.ts
@@ -109,10 +109,16 @@ export const loadAllSocialsForUser = async (userId: string, token?: string) => {
}
let socials = NO_SOCIAL_ACCOUNTS;
try {
- let socialNeedsUpdate = INTEGRATED_SOCIAL_LIST;
- for (let socialType of socialNeedsUpdate) {
- const social = await loadSocialPosts(userId, socialType, token);
- socials = {...socials, [socialType]: social};
+ const fetchedSocials = await Promise.all(
+ INTEGRATED_SOCIAL_LIST.map((socialType) =>
+ loadSocialPosts(userId, socialType, token).then((data) => ({
+ key: socialType,
+ data,
+ })),
+ ),
+ );
+ for (const fetchedSocial of fetchedSocials) {
+ socials = {...socials, [fetchedSocial.key]: fetchedSocial.data};
}
return socials;
} catch (error) {