20 lines
551 B
TypeScript
20 lines
551 B
TypeScript
import api from './client'
|
|
|
|
export const friendsApi = {
|
|
getFriends: () => api.get('/friends/'),
|
|
|
|
getPendingRequests: () => api.get('/friends/requests'),
|
|
|
|
sendRequest: (toUserId: string, message?: string) =>
|
|
api.post('/friends/request', { to_user_id: toUserId, message }),
|
|
|
|
acceptRequest: (requestId: string) =>
|
|
api.put(`/friends/request/${requestId}/accept`),
|
|
|
|
rejectRequest: (requestId: string) =>
|
|
api.put(`/friends/request/${requestId}/reject`),
|
|
|
|
removeFriend: (friendId: string) =>
|
|
api.delete(`/friends/${friendId}`),
|
|
}
|