diff options
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/friends.ts | 13 | 
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utils/friends.ts b/src/utils/friends.ts index ba15e087..3398c123 100644 --- a/src/utils/friends.ts +++ b/src/utils/friends.ts @@ -4,6 +4,7 @@ import {RootState} from '../store/rootReducer';  import {ProfilePreviewType, ProfileType, ScreenType, UserType} from '../types';  import {AppDispatch} from '../store/configureStore';  import { +  addFriend,    friendUnfriendUser,    unfriendUser,    updateUserXFriends, @@ -52,3 +53,15 @@ export const handleUnfriend = async (    await dispatch(updateUserXFriends(friend.id, state));    dispatch(updateUserXProfileAllScreens(friend.id, state));  }; + +export const handleAddFriend = async ( +  screenType: ScreenType, +  friend: ProfilePreviewType, +  dispatch: AppDispatch, +  state: RootState, +) => { +  const success = await dispatch(addFriend(friend, screenType)); +  await dispatch(updateUserXFriends(friend.id, state)); +  await dispatch(updateUserXProfileAllScreens(friend.id, state)); +  return success; +};  | 
