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/services/UserProfileService.ts | |
parent | 4844b69ed6c381fe8e573e77d32302965c4de274 (diff) |
cleaned up logic
Diffstat (limited to 'src/services/UserProfileService.ts')
-rw-r--r-- | src/services/UserProfileService.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts index e733cb47..828cdbf7 100644 --- a/src/services/UserProfileService.ts +++ b/src/services/UserProfileService.ts @@ -107,8 +107,11 @@ const integratedSocialPostsEndpoints: {[social: string]: string} = { export const loadSocialPosts: ( userId: string, socialType: string, -) => Promise<SocialAccountType> = async (userId, socialType) => { - const token = await AsyncStorage.getItem('token'); + token?: string, +) => Promise<SocialAccountType> = async (userId, socialType, token) => { + if (!token) { + token = (await AsyncStorage.getItem('token')) ?? ''; + } const endpoint = integratedSocialPostsEndpoints[socialType]; const accountData: SocialAccountType = {}; accountData.posts = []; |