File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { FriendsResponse } from "../../types/friends" ;
2+ import api from "../api" ;
3+
4+ export const searchUsers = ( query : string ) =>
5+ api . get ( `/friends/search/?q=${ query } ` ) ;
6+
7+ /* Send friend request */
8+ export const sendFriendRequest = ( id : number ) =>
9+ api . post ( `/friends/send/${ id } /` ) ;
10+
11+ /* Cancel request */
12+ export const cancelFriendRequest = ( requestId : number ) =>
13+ api . post ( `/friends/cancel/${ requestId } /` ) ;
14+
15+ /* Accept request */
16+ export const acceptFriendRequest = ( requestId : number ) =>
17+ api . post ( `/friends/accept/${ requestId } /` ) ;
18+
19+ /* Decline request */
20+ export const declineFriendRequest = ( requestId : number ) =>
21+ api . post ( `/friends/decline/${ requestId } /` ) ;
22+
23+ /* Remove friend */
24+ export const removeFriend = ( userId : number ) =>
25+ api . post ( `/friends/remove/${ userId } /` ) ;
26+
27+ /* Get my friends */
28+ export const getFriends = ( ) =>
29+ // api.get(`/friends/list/`);
30+ api . get < FriendsResponse > ( "/friends/list/" ) ;
31+
32+ /* Incoming requests */
33+ export const getIncomingRequests = ( ) => api . get ( `/friends/requests/` ) ;
34+
35+ /* Sent requests */
36+ export const getSentRequests = ( ) => api . get ( `/friends/requests_sent/` ) ;
You can’t perform that action at this time.
0 commit comments