aboutsummaryrefslogtreecommitdiff
path: root/src/utils/friends.ts
diff options
context:
space:
mode:
authorShravya Ramesh <shravs1208@gmail.com>2021-02-23 08:38:20 -0800
committerShravya Ramesh <shravs1208@gmail.com>2021-02-23 08:38:20 -0800
commitfdd4d22cab5f555f981ba922f5fef9731dbe9e9d (patch)
tree2167e4862777a14f16df04b461216603c9ceb9eb /src/utils/friends.ts
parent7692a4321af074158f75c96b8aa3b71dbf9e3bb5 (diff)
added frind button
Diffstat (limited to 'src/utils/friends.ts')
-rw-r--r--src/utils/friends.ts13
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;
+};