diff options
Diffstat (limited to 'src/components/profile/ProfilePreview.tsx')
-rw-r--r-- | src/components/profile/ProfilePreview.tsx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/components/profile/ProfilePreview.tsx b/src/components/profile/ProfilePreview.tsx index 71fd2a85..cc18e457 100644 --- a/src/components/profile/ProfilePreview.tsx +++ b/src/components/profile/ProfilePreview.tsx @@ -19,6 +19,7 @@ import {useSelector, useDispatch, useStore} from 'react-redux'; import {RootState} from '../../store/rootreducer'; import {logout} from '../../store/actions'; import {fetchUserX, userXInStore} from '../../utils'; +import NavigationBar from 'src/routes/tabs'; const NO_USER: UserType = { userId: '', username: '', @@ -38,6 +39,7 @@ interface ProfilePreviewProps extends ViewProps { previewType: PreviewType; screenType: ScreenType; } + const ProfilePreview: React.FC<ProfilePreviewProps> = ({ profilePreview: {username, first_name, last_name, id}, previewType, @@ -156,6 +158,7 @@ const ProfilePreview: React.FC<ProfilePreviewProps> = ({ * If the user is already present in store, do not fetch again * Finally, Navigate to profile of the user selected */ + if (!userXInStore(state, screenType, user.id)) { await fetchUserX( dispatch, @@ -163,10 +166,10 @@ const ProfilePreview: React.FC<ProfilePreviewProps> = ({ screenType, ); } + const userXId = loggedInUser.username === user.username ? undefined : user.id; navigation.push('Profile', { - username: user.username, - userXId: user.id, - screenType: screenType, + userXId, + screenType, }); } catch (e) { console.log(e); |