// src/api/helpPost.js | |
import { api } from './auth'; // 复用已有的axios实例 | |
export const createPost = (title, content, authorId) => { | |
return api.post('/help/posts', { | |
title, | |
content, | |
authorId | |
}); | |
}; | |
export const getPosts = (page = 1, size = 5) => { | |
return api.get('/help/posts', { | |
params: { page, size } | |
}); | |
}; | |
export const getPostDetail = (postId) => { | |
return api.get(`/help/posts/${postId}`); | |
}; | |
export const likePost = (postId) => { | |
return api.post(`/help/posts/${postId}/like`); | |
}; | |
export const addPostComment = (postId, commentData) => { | |
return api.post(`/help/posts/${postId}/comments`, commentData); | |
}; |