From a7be1ca4e5490ed6a27bd4c90f15b9ac85b0356f Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Fri, 26 Mar 2021 14:31:31 -0700 Subject: resolves undefined error --- src/components/profile/ProfileMoreInfoDrawer.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/components/profile/ProfileMoreInfoDrawer.tsx b/src/components/profile/ProfileMoreInfoDrawer.tsx index 2fec5cca..a77a2e84 100644 --- a/src/components/profile/ProfileMoreInfoDrawer.tsx +++ b/src/components/profile/ProfileMoreInfoDrawer.tsx @@ -24,11 +24,9 @@ const ProfileMoreInfoDrawer: React.FC = (props) => { const {setIsOpen, userXId, isBlocked, handleBlockUnblock, userXName} = props; const { user: {userId, username}, - } = useSelector((state: RootState) => state.user); + profile, + } = useSelector((state: RootState) => state?.user); const isOwnProfile = !userXId || userXName === username; - const {suggested_people_linked} = useSelector( - (state: RootState) => state.user.profile, - ); const goToEditProfile = () => { navigation.push('EditProfile', { @@ -39,7 +37,7 @@ const ProfileMoreInfoDrawer: React.FC = (props) => { }; const goToUpdateSPProfile = () => { - if (suggested_people_linked === 0) { + if (profile.suggested_people_linked === 0) { Alert.alert(ERROR_ATTEMPT_EDIT_SP); } else { // Sending undefined for updatedSelectedBadges to mark that there was no update yet -- cgit v1.2.3-70-g09d2