diff options
author | Ivan Chen <ivan@tagg.id> | 2021-03-24 11:25:58 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-03-24 11:25:58 -0400 |
commit | 6e054a927c390cbc6aba4185921397cdcd867e33 (patch) | |
tree | ba5aef8869c721a6c8e09c690f33a2ed9a8e6d04 /src/utils/users.ts | |
parent | 4844b69ed6c381fe8e573e77d32302965c4de274 (diff) |
cleaned up logic
Diffstat (limited to 'src/utils/users.ts')
-rw-r--r-- | src/utils/users.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/utils/users.ts b/src/utils/users.ts index d1f416e0..e11e8c78 100644 --- a/src/utils/users.ts +++ b/src/utils/users.ts @@ -103,12 +103,15 @@ export const userXInStore = ( * Abstracted the code to laod all socials out. * @param userId userId for whom socials should be fetched */ -export const loadAllSocialsForUser = async (userId: string) => { +export const loadAllSocialsForUser = async (userId: string, token?: string) => { + if (!token) { + token = (await AsyncStorage.getItem('token')) ?? ''; + } let socials = NO_SOCIAL_ACCOUNTS; try { let socialNeedsUpdate = INTEGRATED_SOCIAL_LIST; for (let socialType of socialNeedsUpdate) { - const social = await loadSocialPosts(userId, socialType); + const social = await loadSocialPosts(userId, socialType, token); socials = {...socials, [socialType]: social}; } return socials; @@ -165,4 +168,3 @@ export const defaultUserProfile = () => { const defaultImage = require('../assets/images/avatar-placeholder.png'); return defaultImage; }; - |