Akane1217 | 65b61a7 | 2025-05-17 13:52:25 +0800 | [diff] [blame] | 1 | import { api } from './auth';
|
| 2 |
|
DREW | ae420b2 | 2025-06-02 14:07:20 +0800 | [diff] [blame] | 3 | export const likeHelpPostComment = (commentId) => {
|
Akane1217 | 65b61a7 | 2025-05-17 13:52:25 +0800 | [diff] [blame] | 4 | return api.post(`/help/comments/${commentId}/like`);
|
| 5 | };
|
| 6 |
|
DREW | ae420b2 | 2025-06-02 14:07:20 +0800 | [diff] [blame] | 7 | export const getHelpCommentReplies = (commentId) => {
|
Akane1217 | 65b61a7 | 2025-05-17 13:52:25 +0800 | [diff] [blame] | 8 | return api.get(`/help/comments/${commentId}/replies`);
|
| 9 | };
|
| 10 |
|
DREW | ae420b2 | 2025-06-02 14:07:20 +0800 | [diff] [blame] | 11 | export const addHelpCommentReply = (commentId, replyData) => {
|
Akane1217 | d1e9f71 | 2025-05-29 14:36:56 +0800 | [diff] [blame] | 12 | const formData = new FormData();
|
| 13 | formData.append('authorId', replyData.authorId);
|
| 14 | formData.append('content', replyData.content);
|
| 15 |
|
| 16 | // 如果有图片,添加到formData
|
| 17 | if (replyData.image) {
|
| 18 | formData.append('image', replyData.image);
|
| 19 | }
|
| 20 |
|
| 21 | return api.post(`/help/comments/${commentId}/replies`, formData);
|
| 22 | };
|
| 23 |
|
DREW | ae420b2 | 2025-06-02 14:07:20 +0800 | [diff] [blame] | 24 | export const deleteHelpComment = (commentId, authorId) => {
|
Akane1217 | d1e9f71 | 2025-05-29 14:36:56 +0800 | [diff] [blame] | 25 | return api.delete(`/help/comments/${commentId}`, {
|
| 26 | params: { authorId }
|
| 27 | });
|
Akane1217 | 65b61a7 | 2025-05-17 13:52:25 +0800 | [diff] [blame] | 28 | }; |