Files
chat/frontend/src/api/moments.ts
T
2026-06-13 07:33:46 +08:00

31 lines
911 B
TypeScript

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 } }),
}