From ed91266981e1662b512baa1856d8c921a8718e68 Mon Sep 17 00:00:00 2001 From: Ashm Walia Date: Fri, 15 Jan 2021 16:20:29 -0800 Subject: fixes --- src/components/notifications/Notification.tsx | 46 +++++++++++---------------- 1 file changed, 19 insertions(+), 27 deletions(-) (limited to 'src/components/notifications') diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx index 5e68c6f3..42b10ea3 100644 --- a/src/components/notifications/Notification.tsx +++ b/src/components/notifications/Notification.tsx @@ -97,22 +97,16 @@ const Notification: React.FC = (props) => { } }; - // const handleAcceptRequest = async () => { - // const requester: ProfilePreviewType = { - // id: id, - // username: username, - // first_name: first_name, - // last_name: last_name, - // }; - // dispatch(acceptFriendRequest(requester)); - // dispatch(updateUserXFriends(id, state)); - // console.log('fetching notifications since user accepted request!'); - // dispatch(loadUserNotifications()); - // }; + const handleAcceptRequest = async () => { + await dispatch(acceptFriendRequest({id, username, first_name, last_name})); + await dispatch(updateUserXFriends(id, state)); + dispatch(loadUserNotifications()); + }; - // const handleDeclineFriendRequest = async () => { - // dispatch(declineFriendRequest(id)); - // }; + const handleDeclineFriendRequest = async () => { + await dispatch(declineFriendRequest(id)); + dispatch(loadUserNotifications()); + }; return ( <> @@ -135,6 +129,15 @@ const Notification: React.FC = (props) => { {verbage} + {notification_type === 'FRD_REQ' && ( + + + + )} {/* TODO: Still WIP */} {/* {notification_type === 'CMT' && notification_object && ( @@ -143,13 +146,6 @@ const Notification: React.FC = (props) => { source={{uri: momentURI, cache: 'only-if-cached'}} /> )} */} - {notification_type === 'FRD_REQ' && ( - - - - )} ); }; @@ -160,8 +156,6 @@ const styles = StyleSheet.create({ height: SCREEN_HEIGHT / 10, flex: 1, alignItems: 'center', - borderColor: 'red', - borderWidth: 2, }, avatarContainer: { marginLeft: '5%', @@ -191,9 +185,7 @@ const styles = StyleSheet.create({ width: 42, right: '5%', }, - buttonsContainer: { - - }, + buttonsContainer: {}, }); export default Notification; -- cgit v1.2.3-70-g09d2