diff options
author | Husam Salhab <47015061+hsalhab@users.noreply.github.com> | 2020-12-22 11:49:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-22 11:49:50 -0500 |
commit | 49ed044f5103cf6288fcf5b3ff6d3d720795860c (patch) | |
tree | 0bb15247eff667636c9d96863e5a9f78d8179f4e /src | |
parent | 8dfc9d14848c7979f2df71a0d70c1e56c5510831 (diff) |
update endpoints (#143)
Diffstat (limited to 'src')
-rw-r--r-- | src/components/profile/ProfilePreview.tsx | 4 | ||||
-rw-r--r-- | src/constants/api.ts | 5 | ||||
-rw-r--r-- | src/services/UserProfileService.ts | 8 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/components/profile/ProfilePreview.tsx b/src/components/profile/ProfilePreview.tsx index 9dd03c54..71fd2a85 100644 --- a/src/components/profile/ProfilePreview.tsx +++ b/src/components/profile/ProfilePreview.tsx @@ -12,7 +12,7 @@ import { import {useNavigation} from '@react-navigation/native'; import RNFetchBlob from 'rn-fetch-blob'; import AsyncStorage from '@react-native-community/async-storage'; -import {AVATAR_PHOTO_ENDPOINT} from '../../constants'; +import {PROFILE_PHOTO_THUMBNAIL_ENDPOINT} from '../../constants'; import {UserType, PreviewType} from '../../types'; import {isUserBlocked} from '../../services'; import {useSelector, useDispatch, useStore} from 'react-redux'; @@ -60,7 +60,7 @@ const ProfilePreview: React.FC<ProfilePreviewProps> = ({ const response = await RNFetchBlob.config({ fileCache: true, appendExt: 'jpg', - }).fetch('GET', AVATAR_PHOTO_ENDPOINT + `${id}/`, { + }).fetch('GET', PROFILE_PHOTO_THUMBNAIL_ENDPOINT + `${id}/`, { Authorization: 'Token ' + token, }); const status = response.info().status; diff --git a/src/constants/api.ts b/src/constants/api.ts index 5a752e7b..f9ac3d7c 100644 --- a/src/constants/api.ts +++ b/src/constants/api.ts @@ -8,8 +8,9 @@ export const EDIT_PROFILE_ENDPOINT: string = API_URL + 'edit-profile/'; export const SEND_OTP_ENDPOINT: string = API_URL + 'send-otp/'; export const VERIFY_OTP_ENDPOINT: string = API_URL + 'verify-otp/'; export const PROFILE_INFO_ENDPOINT: string = API_URL + 'user-profile-info/'; -export const COVER_PHOTO_ENDPOINT: string = API_URL + 'large-profile-pic/'; -export const AVATAR_PHOTO_ENDPOINT: string = API_URL + 'small-profile-pic/'; +export const HEADER_PHOTO_ENDPOINT: string = API_URL + 'header-pic/'; +export const PROFILE_PHOTO_ENDPOINT: string = API_URL + 'profile-pic/'; +export const PROFILE_PHOTO_THUMBNAIL_ENDPOINT: string = API_URL + 'profile-thumbnail/'; export const GET_IG_POSTS_ENDPOINT: string = API_URL + 'posts-ig/'; export const GET_FB_POSTS_ENDPOINT: string = API_URL + 'posts-fb/'; export const GET_TWITTER_POSTS_ENDPOINT: string = API_URL + 'posts-twitter/'; diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts index 5209aeb7..c67174f9 100644 --- a/src/services/UserProfileService.ts +++ b/src/services/UserProfileService.ts @@ -4,8 +4,8 @@ import {Alert} from 'react-native'; import RNFetchBlob from 'rn-fetch-blob'; import {SocialAccountType} from 'src/types'; import { - AVATAR_PHOTO_ENDPOINT, - COVER_PHOTO_ENDPOINT, + PROFILE_PHOTO_ENDPOINT, + HEADER_PHOTO_ENDPOINT, GET_FB_POSTS_ENDPOINT, GET_IG_POSTS_ENDPOINT, GET_TWITTER_POSTS_ENDPOINT, @@ -46,7 +46,7 @@ export const loadAvatar = async (token: string, userId: string) => { const response = await RNFetchBlob.config({ fileCache: true, appendExt: 'jpg', - }).fetch('GET', AVATAR_PHOTO_ENDPOINT + `${userId}/`, { + }).fetch('GET', PROFILE_PHOTO_ENDPOINT + `${userId}/`, { Authorization: 'Token ' + token, }); const status = response.info().status; @@ -65,7 +65,7 @@ export const loadCover = async (token: string, userId: string) => { let response = await RNFetchBlob.config({ fileCache: true, appendExt: 'jpg', - }).fetch('GET', COVER_PHOTO_ENDPOINT + `${userId}/`, { + }).fetch('GET', HEADER_PHOTO_ENDPOINT + `${userId}/`, { Authorization: 'Token ' + token, }); const status = response.info().status; |