can add images to forum posts and comments
This commit is contained in:
@@ -257,7 +257,12 @@ export const messageAPI = {
|
||||
export const forumAPI = {
|
||||
getPosts: (params?: any) => api.get("/forum/posts", { params }),
|
||||
getPost: (id: string) => api.get(`/forum/posts/${id}`),
|
||||
createPost: (data: any) => api.post("/forum/posts", data),
|
||||
createPost: (formData: FormData) =>
|
||||
api.post("/forum/posts", formData, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
}),
|
||||
updatePost: (id: string, data: any) => api.put(`/forum/posts/${id}`, data),
|
||||
deletePost: (id: string) => api.delete(`/forum/posts/${id}`),
|
||||
updatePostStatus: (id: string, status: string) =>
|
||||
@@ -266,8 +271,12 @@ export const forumAPI = {
|
||||
api.patch(`/forum/posts/${postId}/accept-answer`, { commentId }),
|
||||
getMyPosts: () => api.get("/forum/my-posts"),
|
||||
getTags: (params?: any) => api.get("/forum/tags", { params }),
|
||||
createComment: (postId: string, data: any) =>
|
||||
api.post(`/forum/posts/${postId}/comments`, data),
|
||||
createComment: (postId: string, formData: FormData) =>
|
||||
api.post(`/forum/posts/${postId}/comments`, formData, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
}),
|
||||
updateComment: (commentId: string, data: any) =>
|
||||
api.put(`/forum/comments/${commentId}`, data),
|
||||
deleteComment: (commentId: string) =>
|
||||
@@ -322,4 +331,8 @@ export const feedbackAPI = {
|
||||
export const getMessageImageUrl = (imagePath: string) =>
|
||||
`${API_BASE_URL}/messages/images/${imagePath}`;
|
||||
|
||||
// Helper to construct forum image URLs
|
||||
export const getForumImageUrl = (imagePath: string) =>
|
||||
`${process.env.REACT_APP_BASE_URL}/uploads/forum/${imagePath}`;
|
||||
|
||||
export default api;
|
||||
|
||||
Reference in New Issue
Block a user