This commit is contained in:
2026-06-13 07:33:46 +08:00
parent e2da13bc5c
commit 24017e7454
40 changed files with 3135 additions and 108 deletions
+30
View File
@@ -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 } }),
}