From d85eaeb878cbbeedda860ee5809b81100c910af2 Mon Sep 17 00:00:00 2001 From: Ashm Walia Date: Sat, 16 Jan 2021 09:44:41 -0800 Subject: Done --- src/components/profile/Content.tsx | 12 ------------ src/components/profile/ProfileBody.tsx | 18 +++++++++--------- src/services/UserFriendsServices.ts | 3 --- src/services/UserProfileService.ts | 1 - src/store/actions/userFriends.ts | 2 -- src/store/actions/userX.ts | 2 -- 6 files changed, 9 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx index cc9849e6..9213e012 100644 --- a/src/components/profile/Content.tsx +++ b/src/components/profile/Content.tsx @@ -194,18 +194,6 @@ const Content: React.FC = ({y, userXId, screenType}) => { }, [profile.profile_completion_stage, momentCategories]), ); - /** - * This hook is called on load of profile and when you update the friends list. - */ - // useEffect(() => { - // const isActuallyAFriend = friendsLoggedInUser.some( - // (friend) => friend.username === user.username, - // ); - // if (isFriend != isActuallyAFriend) { - // setIsFriend(isActuallyAFriend); - // } - // }, [friendsLoggedInUser]); - useEffect(() => { const isActuallyBlocked = blockedUsers.some( (cur_user) => user.username === cur_user.username, diff --git a/src/components/profile/ProfileBody.tsx b/src/components/profile/ProfileBody.tsx index 4076e473..64aec09c 100644 --- a/src/components/profile/ProfileBody.tsx +++ b/src/components/profile/ProfileBody.tsx @@ -57,15 +57,9 @@ const ProfileBody: React.FC = ({ const dispatch = useDispatch(); const handleAcceptRequest = async () => { - try { - await dispatch( - acceptFriendRequest({id, username, first_name, last_name}), - ); - await dispatch(updateUserXFriends(id, state)); - dispatch(updateUserXProfileAllScreens(id, state)); - } catch (err) { - console.log(err); - } + await dispatch(acceptFriendRequest({id, username, first_name, last_name})); + await dispatch(updateUserXFriends(id, state)); + dispatch(updateUserXProfileAllScreens(id, state)); }; const handleDeclineFriendRequest = async () => { @@ -144,6 +138,12 @@ const ProfileBody: React.FC = ({ }; const styles = StyleSheet.create({ + toggleButtonContainer: { + flexDirection: 'row', + flex: 1, + paddingTop: '3.5%', + paddingBottom: '2%', + }, acceptRejectContainer: { flexDirection: 'row', }, diff --git a/src/services/UserFriendsServices.ts b/src/services/UserFriendsServices.ts index 97e319f1..18a92481 100644 --- a/src/services/UserFriendsServices.ts +++ b/src/services/UserFriendsServices.ts @@ -64,7 +64,6 @@ export const friendOrUnfriendUser = async ( }, body: body, }); - console.log('FOF', response); const status = response.status; if (Math.floor(status / 100) === 2) { return true; @@ -126,8 +125,6 @@ export const acceptFriendRequestService = async ( token: string | null, ) => { try { - console.log('requester_id: ', requester_id); - console.log('token: ', token); const response = await fetch(FRIENDS_ENDPOINT + `${requester_id}/`, { method: 'PATCH', headers: { diff --git a/src/services/UserProfileService.ts b/src/services/UserProfileService.ts index 80ab4fff..c9ec3604 100644 --- a/src/services/UserProfileService.ts +++ b/src/services/UserProfileService.ts @@ -42,7 +42,6 @@ export const loadProfileInfo = async (token: string, userId: string) => { friendship_status, friendship_requester_id, } = info; - console.log('friendship_requester: ', friendship_requester_id); birthday = birthday && moment(birthday).format('YYYY-MM-DD'); return { name, diff --git a/src/store/actions/userFriends.ts b/src/store/actions/userFriends.ts index 154ed20e..18ad247c 100644 --- a/src/store/actions/userFriends.ts +++ b/src/store/actions/userFriends.ts @@ -71,7 +71,6 @@ export const friendUnfriendUser = ( }); data = 'no_record'; } - console.log('friendship_status data: ', data); dispatch({ type: userXFriendshipEdited.type, payload: { @@ -114,7 +113,6 @@ export const declineFriendRequest = ( dispatch, ) => { try { - console.log('Requesting service to reject friend request'); const token = await getTokenOrLogout(dispatch); const success = await declineFriendRequestService(user_id, token); if (success) { diff --git a/src/store/actions/userX.ts b/src/store/actions/userX.ts index 39d3f918..07bea678 100644 --- a/src/store/actions/userX.ts +++ b/src/store/actions/userX.ts @@ -39,7 +39,6 @@ export const loadUserX = ( }); const token = await getTokenOrLogout(dispatch); loadProfileInfo(token, userId).then((data) => { - console.log('DATA FETCHED: ', data); dispatch({ type: userXProfileFetched.type, payload: {screenType, userId, data}, @@ -145,7 +144,6 @@ export const updateUserXProfileAllScreens = ( screens.forEach((screenType) => { if (userXInStore(state, screenType, userId)) { loadProfileInfo(token, userId).then((data) => { - console.log('DATA FETCHED: ', data); dispatch({ type: userXProfileFetched.type, payload: {screenType, userId, data}, -- cgit v1.2.3-70-g09d2