更新论坛功能
Change-Id: I0efd26d35cc4abb0c6d51ff1bff2cfd738f986dd
diff --git a/src/pages/Forum/posts-detail/api.js b/src/pages/Forum/posts-detail/api.js
new file mode 100644
index 0000000..924cba9
--- /dev/null
+++ b/src/pages/Forum/posts-detail/api.js
@@ -0,0 +1,57 @@
+import axios from 'axios';
+
+const API_BASE = process.env.REACT_APP_API_BASE;
+
+// 获取帖子详情
+export const getPostDetail = async (postId) => {
+ const response = await axios.get(`${API_BASE}/echo/forum/posts/${postId}/getPost`);
+ return response.data;
+};
+
+// 获取帖子评论
+export const getPostComments = async (postId) => {
+ const response = await axios.get(`${API_BASE}/echo/forum/posts/${postId}/getAllComments`);
+ return response.data;
+};
+
+// 点赞帖子
+export const likePost = async (postId) => {
+ const response = await axios.post(`${API_BASE}/echo/forum/posts/${postId}/like`);
+ return response.data;
+};
+
+// 取消点赞帖子
+export const unlikePost = async (postId) => {
+ const response = await axios.delete(`${API_BASE}/echo/forum/posts/${postId}/unlike`);
+ return response.data;
+};
+
+// 添加评论
+export const addCommentToPost = async (postId, content) => {
+ const response = await axios.post(`${API_BASE}/echo/forum/posts/${postId}/comments`, { content });
+ return response.data;
+};
+
+// 回复评论
+export const replyToComment = async (commentId, replyContent) => {
+ const response = await axios.post(`${API_BASE}/echo/forum/comments/${commentId}/reply`, { content: replyContent });
+ return response.data;
+};
+
+// 点赞评论
+export const likeComment = async (commentId) => {
+ const response = await axios.post(`${API_BASE}/echo/forum/comments/${commentId}/like`);
+ return response.data;
+};
+
+// 取消点赞评论
+export const unlikeComment = async (commentId) => {
+ const response = await axios.delete(`${API_BASE}/echo/forum/comments/${commentId}/unlike`);
+ return response.data;
+};
+
+// 获取用户信息
+export const getUserInfo = async (userId) => {
+ const response = await axios.get(`${API_BASE}/user/${userId}/info`);
+ return response.data;
+};
\ No newline at end of file