Files
quyun/frontend/admin/src/api/postService.js
2025-12-20 14:11:44 +08:00

29 lines
726 B
JavaScript

import httpClient from './httpClient';
export const postService = {
getPosts({ page = 1, limit = 10, keyword = '' } = {}) {
return httpClient.get('/posts', {
params: {
page,
limit,
keyword: keyword.trim()
}
});
},
getPost(id) {
return httpClient.get(`/posts/${id}`);
},
createPost(post) {
return httpClient.post('/posts', post);
},
updatePost(id, post) {
return httpClient.put(`/posts/${id}`, post);
},
deletePost(id) {
return httpClient.delete(`/posts/${id}`);
},
sendTo(id, userId) {
return httpClient.post(`/posts/${id}/send-to/${userId}`);
},
}