1.0
This commit is contained in:
@@ -11,6 +11,18 @@ export const chatApi = {
|
||||
|
||||
getConversationDetail: (id: string) => api.get(`/conversations/${id}`),
|
||||
|
||||
updateGroup: (id: string, data: { name?: string; description?: string }) =>
|
||||
api.put(`/conversations/${id}`, data),
|
||||
|
||||
addMembers: (convId: string, userIds: string[]) =>
|
||||
api.post(`/conversations/${convId}/members`, { user_ids: userIds }),
|
||||
|
||||
removeMember: (convId: string, userId: string) =>
|
||||
api.delete(`/conversations/${convId}/members/${userId}`),
|
||||
|
||||
leaveGroup: (convId: string) =>
|
||||
api.post(`/conversations/${convId}/leave`),
|
||||
|
||||
getMessages: (conversationId: string, before?: string, limit = 50) => {
|
||||
const params: Record<string, any> = { limit }
|
||||
if (before) params.before = before
|
||||
|
||||
@@ -8,12 +8,18 @@ export const friendsApi = {
|
||||
sendRequest: (toUserId: string, message?: string) =>
|
||||
api.post('/friends/request', { to_user_id: toUserId, message }),
|
||||
|
||||
addDirect: (toUserId: string) =>
|
||||
api.post('/friends/add-direct', { to_user_id: toUserId }),
|
||||
|
||||
acceptRequest: (requestId: string) =>
|
||||
api.put(`/friends/request/${requestId}/accept`),
|
||||
|
||||
rejectRequest: (requestId: string) =>
|
||||
api.put(`/friends/request/${requestId}/reject`),
|
||||
|
||||
updateRemark: (friendUserId: string, remark: string | null) =>
|
||||
api.put(`/friends/${friendUserId}/remark`, { remark }),
|
||||
|
||||
removeFriend: (friendId: string) =>
|
||||
api.delete(`/friends/${friendId}`),
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import api from './client'
|
||||
|
||||
export const momentsApi = {
|
||||
getFeed: (cursor?: string, limit = 20) =>
|
||||
api.get('/moments/', { params: { cursor, limit } }),
|
||||
|
||||
createMoment: (data: { content: string; images?: string[]; visibility?: string }) =>
|
||||
api.post('/moments/', data),
|
||||
|
||||
deleteMoment: (id: string) =>
|
||||
api.delete(`/moments/${id}`),
|
||||
|
||||
toggleLike: (id: string) =>
|
||||
api.post(`/moments/${id}/like`),
|
||||
|
||||
getComments: (id: string) =>
|
||||
api.get(`/moments/${id}/comments`),
|
||||
|
||||
addComment: (momentId: string, content: string, replyToId?: string) =>
|
||||
api.post(`/moments/${momentId}/comments`, {
|
||||
content,
|
||||
reply_to_id: replyToId || null,
|
||||
}),
|
||||
|
||||
deleteComment: (momentId: string, commentId: string) =>
|
||||
api.delete(`/moments/${momentId}/comments/${commentId}`),
|
||||
|
||||
getUserMoments: (userId: string, cursor?: string) =>
|
||||
api.get(`/moments/user/${userId}`, { params: { cursor } }),
|
||||
}
|
||||
Reference in New Issue
Block a user