From 593347d11dfa0d7c9d32cb79c2639041ce07d849 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 16 Mar 2021 13:11:06 -0400 Subject: using s3 url instead of image passed from backend --- src/assets/images/avatar-placeholder.png | Bin 2982 -> 6245 bytes src/assets/images/avatar-placeholder@2x.png | Bin 6245 -> 0 bytes src/assets/images/avatar-placeholder@3x.png | Bin 7604 -> 0 bytes src/assets/images/cover-placeholder.png | Bin 4117 -> 8875 bytes src/assets/images/cover-placeholder@2x.png | Bin 8875 -> 0 bytes src/assets/images/cover-placeholder@3x.png | Bin 13944 -> 0 bytes src/components/profile/Avatar.tsx | 7 ++-- src/components/profile/Cover.tsx | 11 +++---- src/services/UserProfileService.ts | 49 ++++++++-------------------- src/store/actions/user.ts | 7 ++-- src/store/actions/userX.ts | 35 ++++++++++---------- src/store/initialStates.ts | 4 +-- 12 files changed, 42 insertions(+), 71 deletions(-) delete mode 100644 src/assets/images/avatar-placeholder@2x.png delete mode 100644 src/assets/images/avatar-placeholder@3x.png delete mode 100644 src/assets/images/cover-placeholder@2x.png delete mode 100644 src/assets/images/cover-placeholder@3x.png (limited to 'src') diff --git a/src/assets/images/avatar-placeholder.png b/src/assets/images/avatar-placeholder.png index 313f384e..d038441e 100644 Binary files a/src/assets/images/avatar-placeholder.png and b/src/assets/images/avatar-placeholder.png differ diff --git a/src/assets/images/avatar-placeholder@2x.png b/src/assets/images/avatar-placeholder@2x.png deleted file mode 100644 index d038441e..00000000 Binary files a/src/assets/images/avatar-placeholder@2x.png and /dev/null differ diff --git a/src/assets/images/avatar-placeholder@3x.png b/src/assets/images/avatar-placeholder@3x.png deleted file mode 100644 index 814472ec..00000000 Binary files a/src/assets/images/avatar-placeholder@3x.png and /dev/null differ diff --git a/src/assets/images/cover-placeholder.png b/src/assets/images/cover-placeholder.png index 141167d1..402ac1fe 100644 Binary files a/src/assets/images/cover-placeholder.png and b/src/assets/images/cover-placeholder.png differ diff --git a/src/assets/images/cover-placeholder@2x.png b/src/assets/images/cover-placeholder@2x.png deleted file mode 100644 index 402ac1fe..00000000 Binary files a/src/assets/images/cover-placeholder@2x.png and /dev/null differ diff --git a/src/assets/images/cover-placeholder@3x.png b/src/assets/images/cover-placeholder@3x.png deleted file mode 100644 index be87023d..00000000 Binary files a/src/assets/images/cover-placeholder@3x.png and /dev/null differ diff --git a/src/components/profile/Avatar.tsx b/src/components/profile/Avatar.tsx index ba4ec36c..5d677983 100644 --- a/src/components/profile/Avatar.tsx +++ b/src/components/profile/Avatar.tsx @@ -19,11 +19,8 @@ const Avatar: React.FC = ({style, screenType, userXId}) => { return ( ); }; diff --git a/src/components/profile/Cover.tsx b/src/components/profile/Cover.tsx index a03ef123..b7502cff 100644 --- a/src/components/profile/Cover.tsx +++ b/src/components/profile/Cover.tsx @@ -1,7 +1,7 @@ import React from 'react'; import {Image, StyleSheet, View} from 'react-native'; -import {IMAGE_WIDTH, COVER_HEIGHT, IMAGE_HEIGHT} from '../../constants'; import {useSelector} from 'react-redux'; +import {COVER_HEIGHT, IMAGE_WIDTH} from '../../constants'; import {RootState} from '../../store/rootreducer'; import {ScreenType} from '../../types'; @@ -10,7 +10,7 @@ interface CoverProps { screenType: ScreenType; } const Cover: React.FC = ({userXId, screenType}) => { - const {cover = ''} = userXId + const {cover} = userXId ? useSelector((state: RootState) => state.userX[screenType][userXId]) : useSelector((state: RootState) => state.user); @@ -18,11 +18,8 @@ const Cover: React.FC = ({userXId, screenType}) => { ); diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts index dd77db9f..05fd5f82 100644 --- a/src/services/UserProfileService.ts +++ b/src/services/UserProfileService.ts @@ -77,43 +77,22 @@ export const loadProfileInfo = async (token: string, userId: string) => { } }; -export const loadAvatar = async (userId: string, thumbnail: boolean) => { - try { - const token = await AsyncStorage.getItem('token'); - const url = thumbnail - ? PROFILE_PHOTO_THUMBNAIL_ENDPOINT - : PROFILE_PHOTO_ENDPOINT; - const response = await RNFetchBlob.config({ - fileCache: true, - appendExt: 'jpg', - }).fetch('GET', url + `${userId}/`, { - Authorization: 'Token ' + token, - }); - const status = response.info().status; - if (status === 200) { - return response.path(); - } else { - return ''; - } - } catch (error) { - console.log(error); - return ''; - } -}; - -export const loadCover = async (token: string, userId: string) => { +export const getProfilePic = async ( + token: string, + userId: string, + type: 'large' | 'small', +) => { try { - let response = await RNFetchBlob.config({ - fileCache: true, - appendExt: 'jpg', - }).fetch('GET', HEADER_PHOTO_ENDPOINT + `${userId}/`, { - Authorization: 'Token ' + token, + const url = + type === 'small' ? PROFILE_PHOTO_ENDPOINT : HEADER_PHOTO_ENDPOINT; + const response = await fetch(url + `${userId}/`, { + method: 'GET', + headers: { + Authorization: 'Token ' + token, + }, }); - const status = response.info().status; - if (status === 200) { - return response.path(); - } else { - return ''; + if (response.status === 200) { + return (await response.json()).url; } } catch (error) { console.log(error); diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts index 4f1da47c..aae38d94 100644 --- a/src/store/actions/user.ts +++ b/src/store/actions/user.ts @@ -1,7 +1,6 @@ import {Action, ThunkAction} from '@reduxjs/toolkit'; import { - loadAvatar, - loadCover, + getProfilePic, loadProfileInfo, sendSuggestedPeopleLinked, } from '../../services'; @@ -43,8 +42,8 @@ export const loadUserData = ( const token = await getTokenOrLogout(dispatch); const [profile, avatar, cover] = await Promise.all([ loadProfileInfo(token, user.userId), - loadAvatar(user.userId, false), - loadCover(token, user.userId), + getProfilePic(token, user.userId, 'small'), + getProfilePic(token, user.userId, 'large'), ]); dispatch({ type: userDetailsFetched.type, diff --git a/src/store/actions/userX.ts b/src/store/actions/userX.ts index 07bea678..325c7568 100644 --- a/src/store/actions/userX.ts +++ b/src/store/actions/userX.ts @@ -1,28 +1,27 @@ -import {userXInStore} from './../../utils/'; -import {getTokenOrLogout, loadAllSocialsForUser} from './../../utils'; -import {UserType, ScreenType} from '../../types/types'; -import {RootState} from '../rootReducer'; import {Action, ThunkAction} from '@reduxjs/toolkit'; import { - userXRequested, + getProfilePic, + loadFriends, + loadMomentCategories, + loadMoments, + loadProfileInfo, +} from '../../services'; +import {ScreenType, UserType} from '../../types/types'; +import { + resetScreen, userXAvatarFetched, - userXFriendsFetched, userXCoverFetched, + userXFriendsFetched, + userXMomentCategoriesFetched, userXMomentsFetched, userXProfileFetched, + userXRequested, userXSocialsFetched, userXUserFetched, - userXMomentCategoriesFetched, - resetScreen, } from '../reducers'; -import { - loadProfileInfo, - loadAvatar, - loadCover, - loadFriends, - loadMomentCategories, - loadMoments, -} from '../../services'; +import {RootState} from '../rootReducer'; +import {getTokenOrLogout, loadAllSocialsForUser} from './../../utils'; +import {userXInStore} from './../../utils/'; export const loadUserX = ( user: UserType, @@ -50,13 +49,13 @@ export const loadUserX = ( payload: {screenType, userId, data}, }), ); - loadAvatar(userId, false).then((data) => + getProfilePic(token, userId, 'small').then((data) => dispatch({ type: userXAvatarFetched.type, payload: {screenType, userId, data}, }), ); - loadCover(token, userId).then((data) => + getProfilePic(token, userId, 'large').then((data) => dispatch({ type: userXCoverFetched.type, payload: {screenType, userId, data}, diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts index b43e4a1d..275664cc 100644 --- a/src/store/initialStates.ts +++ b/src/store/initialStates.ts @@ -42,8 +42,8 @@ export const EMPTY_PROFILE_PREVIEW_LIST = []; export const NO_USER_DATA = { user: NO_USER, profile: NO_PROFILE, - avatar: '', - cover: '', + avatar: '', + cover: '', isOnboardedUser: false, newVersionAvailable: false, newNotificationReceived: false, -- cgit v1.2.3-70-g09d2 From 0f406a2305421a69151e53af3c41350d9b976cc8 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 16 Mar 2021 13:19:37 -0400 Subject: comment out logs and removed unused code --- src/components/search/SearchBar.tsx | 4 ++-- src/components/search/SearchCategories.tsx | 18 ------------------ 2 files changed, 2 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/components/search/SearchBar.tsx b/src/components/search/SearchBar.tsx index 1a855f20..1d0021ad 100644 --- a/src/components/search/SearchBar.tsx +++ b/src/components/search/SearchBar.tsx @@ -70,8 +70,8 @@ const SearchBar: React.FC = ({ // TODO: FIGURE OUT WHY CHANGES IN placeholderId ARE NOT REFLECTED HERE // my thought: the value is set when the function is defined, so it keeps // its inital value of -1 forever. - console.log(`Previous ID: ${placeholderId}`); - console.log(`Next ID: ${nextId}`); + // console.log(`Previous ID: ${placeholderId}`); + // console.log(`Next ID: ${nextId}`); setPlaceholderId(nextId); }; diff --git a/src/components/search/SearchCategories.tsx b/src/components/search/SearchCategories.tsx index 4bae27c2..c747b34f 100644 --- a/src/components/search/SearchCategories.tsx +++ b/src/components/search/SearchCategories.tsx @@ -73,23 +73,5 @@ const styles = StyleSheet.create({ flexWrap: 'wrap', justifyContent: 'space-evenly', }, - buttonContainer: { - backgroundColor: 'transparent', - width: 158, - height: 37, - borderRadius: 20, - borderColor: 'transparent', - borderWidth: 1, - flexDirection: 'row', - alignContent: 'center', - justifyContent: 'center', - }, - buttonText: { - fontWeight: '400', - fontSize: 15, - lineHeight: 17.9, - alignSelf: 'center', - color: 'white', - }, }); export default SearchCategories; -- cgit v1.2.3-70-g09d2 From 8022d908ca09860424529d818e210d63fff9f398 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 16 Mar 2021 13:27:09 -0400 Subject: better fix for images --- src/assets/images/avatar-placeholder.png | Bin 6245 -> 0 bytes src/assets/images/avatar-placeholder@2x.png | Bin 0 -> 6245 bytes src/assets/images/avatar-placeholder@3x.png | Bin 0 -> 7604 bytes src/assets/images/cover-placeholder.png | Bin 8875 -> 0 bytes src/assets/images/cover-placeholder@2x.png | Bin 0 -> 8875 bytes src/assets/images/cover-placeholder@3x.png | Bin 0 -> 13944 bytes src/services/UserProfileService.ts | 2 -- src/store/initialStates.ts | 9 ++++----- src/types/types.ts | 4 ++-- 9 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 src/assets/images/avatar-placeholder.png create mode 100644 src/assets/images/avatar-placeholder@2x.png create mode 100644 src/assets/images/avatar-placeholder@3x.png delete mode 100644 src/assets/images/cover-placeholder.png create mode 100644 src/assets/images/cover-placeholder@2x.png create mode 100644 src/assets/images/cover-placeholder@3x.png (limited to 'src') diff --git a/src/assets/images/avatar-placeholder.png b/src/assets/images/avatar-placeholder.png deleted file mode 100644 index d038441e..00000000 Binary files a/src/assets/images/avatar-placeholder.png and /dev/null differ diff --git a/src/assets/images/avatar-placeholder@2x.png b/src/assets/images/avatar-placeholder@2x.png new file mode 100644 index 00000000..d038441e Binary files /dev/null and b/src/assets/images/avatar-placeholder@2x.png differ diff --git a/src/assets/images/avatar-placeholder@3x.png b/src/assets/images/avatar-placeholder@3x.png new file mode 100644 index 00000000..814472ec Binary files /dev/null and b/src/assets/images/avatar-placeholder@3x.png differ diff --git a/src/assets/images/cover-placeholder.png b/src/assets/images/cover-placeholder.png deleted file mode 100644 index 402ac1fe..00000000 Binary files a/src/assets/images/cover-placeholder.png and /dev/null differ diff --git a/src/assets/images/cover-placeholder@2x.png b/src/assets/images/cover-placeholder@2x.png new file mode 100644 index 00000000..402ac1fe Binary files /dev/null and b/src/assets/images/cover-placeholder@2x.png differ diff --git a/src/assets/images/cover-placeholder@3x.png b/src/assets/images/cover-placeholder@3x.png new file mode 100644 index 00000000..be87023d Binary files /dev/null and b/src/assets/images/cover-placeholder@3x.png differ diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts index 05fd5f82..de24d2d6 100644 --- a/src/services/UserProfileService.ts +++ b/src/services/UserProfileService.ts @@ -1,7 +1,6 @@ import AsyncStorage from '@react-native-community/async-storage'; import moment from 'moment'; import {Alert} from 'react-native'; -import RNFetchBlob from 'rn-fetch-blob'; import { GET_FB_POSTS_ENDPOINT, GET_IG_POSTS_ENDPOINT, @@ -10,7 +9,6 @@ import { PASSWORD_RESET_ENDPOINT, PROFILE_INFO_ENDPOINT, PROFILE_PHOTO_ENDPOINT, - PROFILE_PHOTO_THUMBNAIL_ENDPOINT, REGISTER_ENDPOINT, SEND_OTP_ENDPOINT, TAGG_CUSTOMER_SUPPORT, diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts index 275664cc..d89927a7 100644 --- a/src/store/initialStates.ts +++ b/src/store/initialStates.ts @@ -1,6 +1,5 @@ import {CommentThreadType} from './../types/types'; import { - ExploreSectionType, MomentType, NotificationType, ProfilePreviewType, @@ -42,8 +41,8 @@ export const EMPTY_PROFILE_PREVIEW_LIST = []; export const NO_USER_DATA = { user: NO_USER, profile: NO_PROFILE, - avatar: '', - cover: '', + avatar: undefined, + cover: undefined, isOnboardedUser: false, newVersionAvailable: false, newNotificationReceived: false, @@ -98,8 +97,8 @@ export const EMPTY_USER_X = { socialAccounts: NO_SOCIAL_ACCOUNTS, user: NO_USER, profile: NO_PROFILE, - avatar: '', - cover: '', + avatar: undefined, + cover: undefined, }; /** diff --git a/src/types/types.ts b/src/types/types.ts index e068eeba..4f62310a 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -148,8 +148,8 @@ export interface UserXType { momentCategories: string[]; user: UserType; profile: ProfileType; - avatar: string; - cover: string; + avatar: string | undefined; + cover: string | undefined; } /** -- cgit v1.2.3-70-g09d2 From 0187200d794d54c1d9954dd86a6a156132dedcac Mon Sep 17 00:00:00 2001 From: ankit-thanekar007 Date: Mon, 22 Mar 2021 12:18:12 -0700 Subject: TMA 642 Touchable Opacity redirection --- src/components/moments/MomentPostHeader.tsx | 20 ++++++++++++++++---- src/components/profile/Content.tsx | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/components/moments/MomentPostHeader.tsx b/src/components/moments/MomentPostHeader.tsx index aad776e8..56b073d6 100644 --- a/src/components/moments/MomentPostHeader.tsx +++ b/src/components/moments/MomentPostHeader.tsx @@ -1,5 +1,11 @@ import React, {useState} from 'react'; -import {StyleSheet, Text, View, ViewProps} from 'react-native'; +import { + StyleSheet, + Text, + TouchableOpacity, + View, + ViewProps, +} from 'react-native'; import {MomentMoreInfoDrawer} from '../profile'; import {loadUserMoments} from '../../store/actions'; import {useDispatch, useSelector} from 'react-redux'; @@ -29,17 +35,23 @@ const MomentPostHeader: React.FC = ({ (state: RootState) => state.user.user, ); const isOwnProfile = loggedInUserName === username; - return ( - + { + navigation.navigate('Profile', { + userXId: isOwnProfile ? undefined : userXId, + screenType, + }); + }} + style={styles.header}> {username} - + = ({y, userXId, screenType}) => { isBlocked, }} /> - + {userXId && moments.length === 0 && ( -- cgit v1.2.3-70-g09d2 From b2c3242021348274fc518a7e716dc9e0d6d1586d Mon Sep 17 00:00:00 2001 From: ankit-thanekar007 Date: Mon, 22 Mar 2021 12:25:39 -0700 Subject: TMA 642 Refactoring --- src/components/moments/MomentPostHeader.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/components/moments/MomentPostHeader.tsx b/src/components/moments/MomentPostHeader.tsx index 56b073d6..9abf7fce 100644 --- a/src/components/moments/MomentPostHeader.tsx +++ b/src/components/moments/MomentPostHeader.tsx @@ -30,21 +30,21 @@ const MomentPostHeader: React.FC = ({ }) => { const [drawerVisible, setDrawerVisible] = useState(false); const dispatch = useDispatch(); + const navigation = useNavigation(); const {userId: loggedInUserId, username: loggedInUserName} = useSelector( (state: RootState) => state.user.user, ); const isOwnProfile = loggedInUserName === username; + const navigateToProfile = () => { + navigation.navigate('Profile', { + userXId: isOwnProfile ? undefined : userXId, + screenType, + }); + }; return ( - { - navigation.navigate('Profile', { - userXId: isOwnProfile ? undefined : userXId, - screenType, - }); - }} - style={styles.header}> + Date: Tue, 23 Mar 2021 11:59:00 -0700 Subject: User not present check --- src/components/notifications/Notification.tsx | 45 ++++++++++++++++++++------- src/components/profile/Content.tsx | 12 ++++--- 2 files changed, 41 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx index c8a8aa06..8143e396 100644 --- a/src/components/notifications/Notification.tsx +++ b/src/components/notifications/Notification.tsx @@ -205,11 +205,22 @@ const Notification: React.FC = (props) => { dispatch(loadUserNotifications()); }; + const isOwnProfile = id === loggedInUser.userId; + const navigateToProfile = async () => { + if (!userXInStore(state, screenType, id)) { + await fetchUserX(dispatch, {userId: id, username: username}, screenType); + } + navigation.navigate('Profile', { + userXId: isOwnProfile ? undefined : id, + screenType, + }); + }; + const renderContent = () => ( - - + + = (props) => { : require('../../assets/images/avatar-placeholder.png') } /> - + - - {first_name} {last_name} - - {verbage} + + + {first_name} {last_name} + + + + {verbage} + {notification_type === 'FRD_REQ' && ( @@ -238,9 +253,13 @@ const Notification: React.FC = (props) => { notification_type === 'MOM_3+' || notification_type === 'MOM_FRIEND') && notification_object && ( - + + + )} - + ); return unread ? ( @@ -284,7 +303,6 @@ const styles = StyleSheet.create({ fontWeight: '700', }, moment: { - position: 'absolute', height: 42, width: 42, right: '5%', @@ -292,6 +310,9 @@ const styles = StyleSheet.create({ buttonsContainer: { height: '80%', }, + imageFlex: { + flex: 1, + }, }); export default Notification; diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx index 7f922bd9..1a5a205c 100644 --- a/src/components/profile/Content.tsx +++ b/src/components/profile/Content.tsx @@ -109,9 +109,10 @@ const Content: React.FC = ({y, userXId, screenType}) => { const [isStageOnePromptClosed, setIsStageOnePromptClosed] = useState( false, ); - const [isStageThreePromptClosed, setIsStageThreePromptClosed] = useState< - boolean - >(false); + const [ + isStageThreePromptClosed, + setIsStageThreePromptClosed, + ] = useState(false); const onRefresh = useCallback(() => { const refrestState = async () => { @@ -308,7 +309,10 @@ const Content: React.FC = ({y, userXId, screenType}) => { isBlocked, }} /> - + {userXId && moments.length === 0 && ( -- cgit v1.2.3-70-g09d2 From ef3e601ba92a91334245c48b0a8d03e3b1cacc7a Mon Sep 17 00:00:00 2001 From: ankit-thanekar007 Date: Tue, 23 Mar 2021 12:03:37 -0700 Subject: User not present check --- src/components/moments/MomentPostHeader.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/components/moments/MomentPostHeader.tsx b/src/components/moments/MomentPostHeader.tsx index 9abf7fce..ff324c4a 100644 --- a/src/components/moments/MomentPostHeader.tsx +++ b/src/components/moments/MomentPostHeader.tsx @@ -8,11 +8,12 @@ import { } from 'react-native'; import {MomentMoreInfoDrawer} from '../profile'; import {loadUserMoments} from '../../store/actions'; -import {useDispatch, useSelector} from 'react-redux'; +import {useDispatch, useSelector, useStore} from 'react-redux'; import {ScreenType} from '../../types'; import Avatar from '../profile/Avatar'; import {useNavigation} from '@react-navigation/native'; import {RootState} from '../../store/rootReducer'; +import {fetchUserX, userXInStore} from '../../utils'; interface MomentPostHeaderProps extends ViewProps { userXId?: string; @@ -30,18 +31,26 @@ const MomentPostHeader: React.FC = ({ }) => { const [drawerVisible, setDrawerVisible] = useState(false); const dispatch = useDispatch(); - + const state: RootState = useStore().getState(); const navigation = useNavigation(); const {userId: loggedInUserId, username: loggedInUserName} = useSelector( (state: RootState) => state.user.user, ); const isOwnProfile = loggedInUserName === username; - const navigateToProfile = () => { + const navigateToProfile = async () => { + if (userXId && !userXInStore(state, screenType, userXId)) { + await fetchUserX( + dispatch, + {userId: userXId, username: username}, + screenType, + ); + } navigation.navigate('Profile', { userXId: isOwnProfile ? undefined : userXId, screenType, }); }; + return ( -- cgit v1.2.3-70-g09d2 From 4844b69ed6c381fe8e573e77d32302965c4de274 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 23 Mar 2021 16:18:19 -0400 Subject: updated types, using api/profile --- src/constants/api.ts | 1 + src/services/UserProfileService.ts | 24 +++++++++++- src/store/actions/userX.ts | 77 +++++++++++++++++++++++++------------- src/store/initialStates.ts | 6 +-- src/types/types.ts | 12 +++++- src/utils/friends.ts | 4 +- src/utils/users.ts | 4 +- 7 files changed, 93 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/constants/api.ts b/src/constants/api.ts index 34ef9a1c..d2d43063 100644 --- a/src/constants/api.ts +++ b/src/constants/api.ts @@ -9,6 +9,7 @@ export const REGISTER_ENDPOINT: string = API_URL + 'register/'; 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 USER_PROFILE_ENDPOINT: string = API_URL + 'profile/'; export const PROFILE_INFO_ENDPOINT: string = API_URL + 'user-profile-info/'; export const HEADER_PHOTO_ENDPOINT: string = API_URL + 'header-pic/'; export const PROFILE_PHOTO_ENDPOINT: string = API_URL + 'profile-pic/'; diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts index de24d2d6..e733cb47 100644 --- a/src/services/UserProfileService.ts +++ b/src/services/UserProfileService.ts @@ -7,6 +7,7 @@ import { GET_TWITTER_POSTS_ENDPOINT, HEADER_PHOTO_ENDPOINT, PASSWORD_RESET_ENDPOINT, + USER_PROFILE_ENDPOINT, PROFILE_INFO_ENDPOINT, PROFILE_PHOTO_ENDPOINT, REGISTER_ENDPOINT, @@ -25,7 +26,7 @@ import { SUCCESS_PWD_RESET, SUCCESS_VERIFICATION_CODE_SENT, } from '../constants/strings'; -import {SocialAccountType} from '../types'; +import {SocialAccountType, ProfileType} from '../types'; export const loadProfileInfo = async (token: string, userId: string) => { try { @@ -333,3 +334,24 @@ export const sendRegister = async ( return undefined; } }; + +export const fetchUserProfile = async (userId: string, token?: string) => { + try { + if (!token) { + token = (await AsyncStorage.getItem('token')) ?? ''; + } + const response = await fetch(USER_PROFILE_ENDPOINT + userId + '/', { + method: 'GET', + headers: { + Authorization: 'Token ' + token, + }, + }); + if (response.status === 200) { + const data: ProfileType = await response.json(); + return data; + } + } catch (error) { + console.log(error); + return undefined; + } +}; diff --git a/src/store/actions/userX.ts b/src/store/actions/userX.ts index 325c7568..5d49cdf9 100644 --- a/src/store/actions/userX.ts +++ b/src/store/actions/userX.ts @@ -1,8 +1,8 @@ import {Action, ThunkAction} from '@reduxjs/toolkit'; +import moment from 'moment'; import { - getProfilePic, + fetchUserProfile, loadFriends, - loadMomentCategories, loadMoments, loadProfileInfo, } from '../../services'; @@ -37,11 +37,56 @@ export const loadUserX = ( payload: {screenType, userId, user}, }); const token = await getTokenOrLogout(dispatch); - loadProfileInfo(token, userId).then((data) => { - dispatch({ - type: userXProfileFetched.type, - payload: {screenType, userId, data}, - }); + fetchUserProfile(userId, token).then((profile) => { + if (profile) { + let { + name, + biography, + website, + birthday, + gender, + snapchat, + tiktok, + university_class, + profile_completion_stage, + suggested_people_linked, + friendship_status, + friendship_requester_id, + } = profile.profile_info; + dispatch({ + type: userXProfileFetched.type, + payload: { + screenType, + userId, + data: { + name, + biography, + website, + birthday: birthday && moment(birthday).format('YYYY-MM-DD'), + gender, + snapchat, + tiktok, + university_class, + profile_completion_stage, + suggested_people_linked, + friendship_status, + friendship_requester_id, + }, + }, + }); + dispatch({ + type: userXAvatarFetched.type, + payload: {screenType, userId, data: profile.profile_pic}, + }); + dispatch({ + type: userXCoverFetched.type, + payload: {screenType, userId, data: profile.header_pic}, + }); + dispatch({ + type: userXMomentCategoriesFetched.type, + payload: {screenType, userId, data: profile.moment_categories}, + }); + } }); loadAllSocialsForUser(userId).then((data) => dispatch({ @@ -49,18 +94,6 @@ export const loadUserX = ( payload: {screenType, userId, data}, }), ); - getProfilePic(token, userId, 'small').then((data) => - dispatch({ - type: userXAvatarFetched.type, - payload: {screenType, userId, data}, - }), - ); - getProfilePic(token, userId, 'large').then((data) => - dispatch({ - type: userXCoverFetched.type, - payload: {screenType, userId, data}, - }), - ); loadFriends(userId, token).then((data) => dispatch({ type: userXFriendsFetched.type, @@ -73,12 +106,6 @@ export const loadUserX = ( payload: {screenType, userId, data}, }), ); - loadMomentCategories(userId, token).then((data) => { - dispatch({ - type: userXMomentCategoriesFetched.type, - payload: {screenType, userId, data}, - }); - }); } catch (error) { console.log(error); } diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts index d89927a7..8ffdd559 100644 --- a/src/store/initialStates.ts +++ b/src/store/initialStates.ts @@ -3,14 +3,14 @@ import { MomentType, NotificationType, ProfilePreviewType, - ProfileType, + ProfileInfoType, ScreenType, SocialAccountType, UserType, UserXType, } from '../types'; -export const NO_PROFILE: ProfileType = { +export const NO_PROFILE: ProfileInfoType = { biography: '', website: '', name: '', @@ -40,7 +40,7 @@ export const EMPTY_PROFILE_PREVIEW_LIST = []; export const NO_USER_DATA = { user: NO_USER, - profile: NO_PROFILE, + profile: NO_PROFILE, avatar: undefined, cover: undefined, isOnboardedUser: false, diff --git a/src/types/types.ts b/src/types/types.ts index 4f62310a..8937e74c 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -21,7 +21,15 @@ export interface CategoryPreviewType { export type FriendshipStatusType = 'friends' | 'requested' | 'no_record'; -export interface ProfileType { +export type ProfileType = { + profile_pic: string; + header_pic: string; + profile_info: ProfileInfoType; + moment_categories: string[]; + linked_socials: string[]; +}; + +export interface ProfileInfoType { name: string; biography: string; website: string; @@ -147,7 +155,7 @@ export interface UserXType { socialAccounts: Record; momentCategories: string[]; user: UserType; - profile: ProfileType; + profile: ProfileInfoType; avatar: string | undefined; cover: string | undefined; } diff --git a/src/utils/friends.ts b/src/utils/friends.ts index 3398c123..6e3b645a 100644 --- a/src/utils/friends.ts +++ b/src/utils/friends.ts @@ -1,7 +1,7 @@ // Handles click on friend/requested/unfriend button import {RootState} from '../store/rootReducer'; -import {ProfilePreviewType, ProfileType, ScreenType, UserType} from '../types'; +import {ProfilePreviewType, ProfileInfoType, ScreenType, UserType} from '../types'; import {AppDispatch} from '../store/configureStore'; import { addFriend, @@ -25,7 +25,7 @@ import {getUserAsProfilePreviewType} from './users'; export const handleFriendUnfriend = async ( screenType: ScreenType, user: UserType, - profile: ProfileType, + profile: ProfileInfoType, dispatch: AppDispatch, state: RootState, loggedInUser: UserType, diff --git a/src/utils/users.ts b/src/utils/users.ts index af4f3813..d1f416e0 100644 --- a/src/utils/users.ts +++ b/src/utils/users.ts @@ -20,7 +20,7 @@ import {RootState} from './../store/rootReducer'; import { ProfilePreviewType, CategoryPreviewType, - ProfileType, + ProfileInfoType, ScreenType, UserType, } from './../types/types'; @@ -137,7 +137,7 @@ export const getTokenOrLogout = async (dispatch: Function): Promise => { */ export const getUserAsProfilePreviewType = ( passedInUser: UserType, - passedInProfile: ProfileType, + passedInProfile: ProfileInfoType, ): ProfilePreviewType => { const fullName = passedInProfile.name.split(' '); return { -- cgit v1.2.3-70-g09d2 From 6e054a927c390cbc6aba4185921397cdcd867e33 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Wed, 24 Mar 2021 11:25:58 -0400 Subject: cleaned up logic --- src/services/UserFriendsService.ts | 3 +-- src/services/UserProfileService.ts | 7 +++++-- src/store/actions/userX.ts | 2 +- src/utils/users.ts | 8 +++++--- 4 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/services/UserFriendsService.ts b/src/services/UserFriendsService.ts index dbec1974..5ce9df29 100644 --- a/src/services/UserFriendsService.ts +++ b/src/services/UserFriendsService.ts @@ -16,12 +16,11 @@ export const loadFriends = async (userId: string, token: string) => { if (response.status === 200) { const body = await response.json(); return body; - } else { - throw new Error(await response.json()); } } catch (error) { console.log(error); } + return []; }; export const friendOrUnfriendUser = async ( 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 = async (userId, socialType) => { - const token = await AsyncStorage.getItem('token'); + token?: string, +) => Promise = async (userId, socialType, token) => { + if (!token) { + token = (await AsyncStorage.getItem('token')) ?? ''; + } const endpoint = integratedSocialPostsEndpoints[socialType]; const accountData: SocialAccountType = {}; accountData.posts = []; diff --git a/src/store/actions/userX.ts b/src/store/actions/userX.ts index 5d49cdf9..6302eb3c 100644 --- a/src/store/actions/userX.ts +++ b/src/store/actions/userX.ts @@ -88,7 +88,7 @@ export const loadUserX = ( }); } }); - loadAllSocialsForUser(userId).then((data) => + loadAllSocialsForUser(userId, token).then((data) => dispatch({ type: userXSocialsFetched.type, payload: {screenType, userId, data}, 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; }; - -- cgit v1.2.3-70-g09d2 From fc9564f27ef7b1fd71a25d2081d910e18106035a Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Wed, 24 Mar 2021 12:17:34 -0400 Subject: cleaned up code --- src/store/actions/userX.ts | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/store/actions/userX.ts b/src/store/actions/userX.ts index 6302eb3c..f32a4d8f 100644 --- a/src/store/actions/userX.ts +++ b/src/store/actions/userX.ts @@ -39,38 +39,15 @@ export const loadUserX = ( const token = await getTokenOrLogout(dispatch); fetchUserProfile(userId, token).then((profile) => { if (profile) { - let { - name, - biography, - website, - birthday, - gender, - snapchat, - tiktok, - university_class, - profile_completion_stage, - suggested_people_linked, - friendship_status, - friendship_requester_id, - } = profile.profile_info; + const birthday = profile.profile_info.birthday; dispatch({ type: userXProfileFetched.type, payload: { screenType, userId, data: { - name, - biography, - website, + ...profile.profile_info, birthday: birthday && moment(birthday).format('YYYY-MM-DD'), - gender, - snapchat, - tiktok, - university_class, - profile_completion_stage, - suggested_people_linked, - friendship_status, - friendship_requester_id, }, }, }); -- cgit v1.2.3-70-g09d2 From 96477697afe4dd92ce68f0f778decbca30d83e77 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Wed, 24 Mar 2021 13:21:59 -0400 Subject: async social load --- src/utils/users.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3-70-g09d2 From e01decc7ac5f62469f0491d2e673d57c7745ea4e Mon Sep 17 00:00:00 2001 From: ankit-thanekar007 Date: Wed, 24 Mar 2021 10:48:56 -0700 Subject: Center issue fix --- src/components/moments/IndividualMomentTitleBar.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/components/moments/IndividualMomentTitleBar.tsx b/src/components/moments/IndividualMomentTitleBar.tsx index 88e0c308..79453ade 100644 --- a/src/components/moments/IndividualMomentTitleBar.tsx +++ b/src/components/moments/IndividualMomentTitleBar.tsx @@ -29,14 +29,14 @@ const styles = StyleSheet.create({ container: { flexDirection: 'row', alignItems: 'center', - justifyContent: 'center', + justifyContent: 'flex-start', height: '5%', }, headerContainer: { - flexShrink: 1, - marginLeft: '11%', + width: '80%', }, header: { + textAlign: 'center', color: 'white', fontSize: normalize(18), fontWeight: '700', @@ -44,10 +44,9 @@ const styles = StyleSheet.create({ letterSpacing: normalize(1.3), }, closeButton: { - position: 'absolute', height: '50%', aspectRatio: 1, - left: '3%', + left: '8%', }, }); -- cgit v1.2.3-70-g09d2 From 35ebcd4da8471c9dbdd6bf7923ab06d66db9d364 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Wed, 24 Mar 2021 14:19:29 -0400 Subject: removed dead code --- src/constants/constants.ts | 15 ++------------- src/services/ExploreService.ts | 37 +------------------------------------ src/store/actions/taggUsers.ts | 3 +-- src/store/initialStates.ts | 1 - src/types/types.ts | 9 --------- 5 files changed, 4 insertions(+), 61 deletions(-) (limited to 'src') diff --git a/src/constants/constants.ts b/src/constants/constants.ts index 6b513f4e..d24e352e 100644 --- a/src/constants/constants.ts +++ b/src/constants/constants.ts @@ -1,6 +1,6 @@ import {ReactText} from 'react'; -import {BackgroundGradientType, ExploreSectionType} from './../types/'; -import {SCREEN_WIDTH, SCREEN_HEIGHT, isIPhoneX, normalize} from '../utils'; +import {isIPhoneX, normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../utils'; +import {BackgroundGradientType} from './../types/'; export const CHIN_HEIGHT = 34; @@ -182,17 +182,6 @@ export const MOMENT_CATEGORY_BG_COLORS: string[] = [ '#4E7175', ]; -// order matters, this decides the order which it displays -export const EXPLORE_SECTION_TITLES: ExploreSectionType[] = [ - 'New to Tagg', - 'People You May Know', - 'Trending on Tagg', - "Brown '24", - "Brown '23", - "Brown '22", - "Brown '21", -]; - export const SP_WIDTH = 375; export const SP_HEIGHT = 812; diff --git a/src/services/ExploreService.ts b/src/services/ExploreService.ts index 07af91ad..44df8056 100644 --- a/src/services/ExploreService.ts +++ b/src/services/ExploreService.ts @@ -4,12 +4,7 @@ import { DISCOVER_ENDPOINT, SEARCH_BUTTONS_ENDPOPINT, } from '../constants'; -import {EMPTY_PROFILE_PREVIEW_LIST} from '../store/initialStates'; -import { - ExploreSectionType, - ProfilePreviewType, - SearchCategoryType, -} from '../types'; +import {ProfilePreviewType, SearchCategoryType} from '../types'; export const getAllTaggUsers = async (token: string) => { try { @@ -38,36 +33,6 @@ export const getAllTaggUsers = async (token: string) => { } }; -export const getAllExploreSections = async () => { - try { - const token = await AsyncStorage.getItem('token'); - const response = await fetch(DISCOVER_ENDPOINT, { - method: 'GET', - headers: { - Authorization: 'Token ' + token, - }, - }); - if (response.status !== 200) { - return EMPTY_PROFILE_PREVIEW_LIST; - } - const data = await response.json(); - // TODO (if we return to original explore format): get keys from backend API - const exploreSections: Record = { - 'New to Tagg': data.categories.new_to_tagg, - 'People You May Know': data.categories.people_you_may_know, - 'Trending on Tagg': data.categories.trending_on_tagg, - "Brown '21": data.categories.brown_21, - "Brown '22": data.categories.brown_22, - "Brown '23": data.categories.brown_23, - "Brown '24": data.categories.brown_24, - }; - - return exploreSections; - } catch (error) { - console.log('Unable to fetch explore data'); - } -}; - export const getDiscoverUsers = async (categoryName: string) => { try { const token = await AsyncStorage.getItem('token'); diff --git a/src/store/actions/taggUsers.ts b/src/store/actions/taggUsers.ts index 72ce848b..0cd94e92 100644 --- a/src/store/actions/taggUsers.ts +++ b/src/store/actions/taggUsers.ts @@ -1,5 +1,5 @@ import {Action, ThunkAction} from '@reduxjs/toolkit'; -import {getAllExploreSections, loadRecentlySearchedUsers} from '../../services'; +import {loadRecentlySearchedUsers} from '../../services'; import {taggUsersFetched} from '../reducers'; import {RootState} from '../rootReducer'; @@ -11,7 +11,6 @@ export const loadRecentlySearched = (): ThunkAction< > => async (dispatch) => { try { const recentSearches = await loadRecentlySearchedUsers(); - getAllExploreSections(); dispatch({ type: taggUsersFetched.type, payload: {recentSearches}, diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts index b43e4a1d..28a4d10a 100644 --- a/src/store/initialStates.ts +++ b/src/store/initialStates.ts @@ -1,6 +1,5 @@ import {CommentThreadType} from './../types/types'; import { - ExploreSectionType, MomentType, NotificationType, ProfilePreviewType, diff --git a/src/types/types.ts b/src/types/types.ts index dc2817bd..fc77ba4b 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -125,15 +125,6 @@ export enum ScreenType { SuggestedPeople, } -export type ExploreSectionType = - | 'People You May Know' - | 'New to Tagg' - | 'Trending on Tagg' - | "Brown '21" - | "Brown '22" - | "Brown '23" - | "Brown '24"; - /** * Redux store to have a Record of ScreenType (Search, Profile, Home etc) mapped to * A Record of userIXd mapped to UserXType -- cgit v1.2.3-70-g09d2 From e80e22569e9699b5bc0f2f7e3cc2f0e790e382a8 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 25 Mar 2021 13:42:26 -0400 Subject: added is_private --- src/services/UserProfileService.ts | 36 ++++++------------------------------ src/store/initialStates.ts | 1 + src/types/types.ts | 1 + 3 files changed, 8 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts index 828cdbf7..b499829f 100644 --- a/src/services/UserProfileService.ts +++ b/src/services/UserProfileService.ts @@ -7,12 +7,12 @@ import { GET_TWITTER_POSTS_ENDPOINT, HEADER_PHOTO_ENDPOINT, PASSWORD_RESET_ENDPOINT, - USER_PROFILE_ENDPOINT, PROFILE_INFO_ENDPOINT, PROFILE_PHOTO_ENDPOINT, REGISTER_ENDPOINT, SEND_OTP_ENDPOINT, TAGG_CUSTOMER_SUPPORT, + USER_PROFILE_ENDPOINT, VERIFY_OTP_ENDPOINT, } from '../constants'; import { @@ -26,7 +26,7 @@ import { SUCCESS_PWD_RESET, SUCCESS_VERIFICATION_CODE_SENT, } from '../constants/strings'; -import {SocialAccountType, ProfileType} from '../types'; +import {ProfileInfoType, ProfileType, SocialAccountType} from '../types'; export const loadProfileInfo = async (token: string, userId: string) => { try { @@ -38,35 +38,11 @@ export const loadProfileInfo = async (token: string, userId: string) => { }); const status = response.status; if (status === 200) { - const info = await response.json(); - let { - name, - biography, - website, - birthday, - gender, - snapchat, - tiktok, - university_class, - profile_completion_stage, - suggested_people_linked, - friendship_status, - friendship_requester_id, - } = info; - birthday = birthday && moment(birthday).format('YYYY-MM-DD'); + const data: ProfileInfoType = await response.json(); + const birthday = data.birthday; return { - name, - biography, - website, - birthday, - gender, - snapchat, - tiktok, - university_class, - profile_completion_stage, - suggested_people_linked, - friendship_status, - friendship_requester_id, + ...data, + birthday: birthday && moment(birthday).format('YYYY-MM-DD'), }; } else { throw 'Unable to load profile data'; diff --git a/src/store/initialStates.ts b/src/store/initialStates.ts index 8ffdd559..47ab8f39 100644 --- a/src/store/initialStates.ts +++ b/src/store/initialStates.ts @@ -25,6 +25,7 @@ export const NO_PROFILE: ProfileInfoType = { tiktok: '', friendship_status: 'no_record', friendship_requester_id: '', + is_private: true, }; export const EMPTY_MOMENTS_LIST = []; diff --git a/src/types/types.ts b/src/types/types.ts index 692da8b4..3a4491a3 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -42,6 +42,7 @@ export interface ProfileInfoType { tiktok: string; friendship_status: FriendshipStatusType; friendship_requester_id: string; + is_private: boolean; } export interface SocialAccountType { -- cgit v1.2.3-70-g09d2 From 54de628b27647099170bc6d5eea7110c8dd5e8f0 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 25 Mar 2021 14:21:43 -0400 Subject: renamed to profile and header --- src/services/UserProfileService.ts | 4 ++-- src/store/actions/user.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts index b499829f..e00c0530 100644 --- a/src/services/UserProfileService.ts +++ b/src/services/UserProfileService.ts @@ -55,11 +55,11 @@ export const loadProfileInfo = async (token: string, userId: string) => { export const getProfilePic = async ( token: string, userId: string, - type: 'large' | 'small', + type: 'profile' | 'header', ) => { try { const url = - type === 'small' ? PROFILE_PHOTO_ENDPOINT : HEADER_PHOTO_ENDPOINT; + type === 'profile' ? PROFILE_PHOTO_ENDPOINT : HEADER_PHOTO_ENDPOINT; const response = await fetch(url + `${userId}/`, { method: 'GET', headers: { diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts index aae38d94..46f96d9a 100644 --- a/src/store/actions/user.ts +++ b/src/store/actions/user.ts @@ -42,8 +42,8 @@ export const loadUserData = ( const token = await getTokenOrLogout(dispatch); const [profile, avatar, cover] = await Promise.all([ loadProfileInfo(token, user.userId), - getProfilePic(token, user.userId, 'small'), - getProfilePic(token, user.userId, 'large'), + getProfilePic(token, user.userId, 'profile'), + getProfilePic(token, user.userId, 'header'), ]); dispatch({ type: userDetailsFetched.type, -- cgit v1.2.3-70-g09d2