From f8dd6b8ef033039278e2931876488c307f5d5adc Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Tue, 8 Jun 2021 14:20:57 -0400 Subject: Create MomentPostType --- src/components/moments/MomentPost.tsx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/components') diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx index 1f363052..4f8bb63f 100644 --- a/src/components/moments/MomentPost.tsx +++ b/src/components/moments/MomentPost.tsx @@ -4,16 +4,20 @@ import {useSelector} from 'react-redux'; import {MomentPostContent, MomentPostHeader} from '.'; import {deleteMomentTag, loadMomentTags} from '../../services'; import {RootState} from '../../store/rootReducer'; -import {MomentTagType, MomentType, ScreenType} from '../../types'; +import {MomentPostType, MomentTagType, ScreenType} from '../../types'; import {SCREEN_HEIGHT} from '../../utils'; interface MomentPostProps { - item: MomentType; + moment: MomentPostType; userXId: string | undefined; screenType: ScreenType; } -const MomentPost: React.FC = ({item, userXId, screenType}) => { +const MomentPost: React.FC = ({ + moment, + userXId, + screenType, +}) => { const {userId: loggedInUserId, username: loggedInUsername} = useSelector( (state: RootState) => state.user.user, ); @@ -29,7 +33,7 @@ const MomentPost: React.FC = ({item, userXId, screenType}) => { const isOwnProfile = username === loggedInUsername; const loadTags = async () => { - const response = await loadMomentTags(item.moment_id); + const response = await loadMomentTags(moment.moment_id); setTags(response ? response : []); }; @@ -74,17 +78,17 @@ const MomentPost: React.FC = ({item, userXId, screenType}) => { userXId={userXId} screenType={screenType} username={isOwnProfile ? loggedInUsername : username} - momentId={item.moment_id} + momentId={moment.moment_id} style={styles.postHeader} momentTagId={momentTagId} removeTag={removeTag} /> -- cgit v1.2.3-70-g09d2