feat: Implement content planning and post management with a new service and calendar view.
This commit is contained in:
24
src/services/postService.js
Normal file
24
src/services/postService.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import api from './api';
|
||||
|
||||
export const postService = {
|
||||
getPosts: (dateFrom, dateTo) => {
|
||||
const params = {};
|
||||
if (dateFrom) params.date_from = dateFrom;
|
||||
if (dateTo) params.date_to = dateTo;
|
||||
return api.get('/posts', { params }).then(r => r.data);
|
||||
},
|
||||
|
||||
createPost: (data) => api.post('/posts', data).then(r => r.data),
|
||||
|
||||
getPost: (id) => api.get(`/posts/${id}`).then(r => r.data),
|
||||
|
||||
updatePost: (id, data) => api.put(`/posts/${id}`, data).then(r => r.data),
|
||||
|
||||
deletePost: (id) => api.delete(`/posts/${id}`).then(r => r.data),
|
||||
|
||||
addGenerations: (postId, generationIds) =>
|
||||
api.post(`/posts/${postId}/generations`, { generation_ids: generationIds }).then(r => r.data),
|
||||
|
||||
removeGeneration: (postId, generationId) =>
|
||||
api.delete(`/posts/${postId}/generations/${generationId}`).then(r => r.data),
|
||||
};
|
||||
Reference in New Issue
Block a user