feat: добавление новых функций для вызова в логике BoardLogic.js
This commit is contained in:
@@ -1,65 +1,83 @@
|
||||
import axios from 'axios';
|
||||
|
||||
export const loadBoardDataAPI = async (boardId) => {
|
||||
return axios.post('/api/boards/load', { id: boardId });
|
||||
return axios.post('/api/boards/load', {id: boardId});
|
||||
};
|
||||
|
||||
export const createTaskAPI = async (taskData) => {
|
||||
return axios.post('/api/boards/categories/tasks/create', taskData);
|
||||
export const createTaskAPI = async (taskCateg, taskTitle, taskDescription) => {
|
||||
return axios.post('/api/boards/categories/tasks/create', {
|
||||
data: {category_id: taskCateg, title: taskTitle, description: taskDescription}
|
||||
});
|
||||
};
|
||||
|
||||
export const createCategoryAPI = async (categoryData) => {
|
||||
return axios.post('/api/boards/categories/create', categoryData);
|
||||
export const createCategoryAPI = async (boardId, categTitle) => {
|
||||
return axios.post('/api/boards/categories/create', {
|
||||
data: {board_id: boardId, title: categTitle}
|
||||
});
|
||||
};
|
||||
|
||||
export const updateTaskAPI = async (updateData) => {
|
||||
return axios.put('/api/boards/categories/tasks/update', updateData);
|
||||
export const updateTaskAPI = async (editedTaskId, editedTaskMethod, editedTaskValue) => {
|
||||
return axios.put('/api/boards/categories/tasks/update', {
|
||||
data: {id: editedTaskId, update_method: editedTaskMethod, value: editedTaskValue}
|
||||
});
|
||||
};
|
||||
|
||||
export const updateCategoryAPI = async (updateData) => {
|
||||
return axios.put('/api/boards/categories/update', updateData);
|
||||
export const updateCategoryAPI = async (editedCategId, editedCategMethod, editedCategTitle) => {
|
||||
return axios.put('/api/boards/categories/update', {
|
||||
data: {id: editedCategId, update_method: editedCategMethod, value: editedCategTitle}
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteCategoryAPI = async (categoryId) => {
|
||||
export const deleteCategoryAPI = async (categId) => {
|
||||
return axios.delete('/api/boards/categories/delete', {
|
||||
data: { id: categoryId }
|
||||
data: {id: categId}
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteTaskAPI = async (taskId) => {
|
||||
return axios.delete('/api/boards/categories/tasks/delete', {
|
||||
data: { id: taskId }
|
||||
data: {id: taskId}
|
||||
});
|
||||
};
|
||||
|
||||
export const assignMemberAPI = async (updateData) => {
|
||||
return axios.put('/api/boards/categories/tasks/assign', updateData);
|
||||
export const assignMemberAPI = async (editedTaskId, memberId) => {
|
||||
return axios.put('/api/boards/categories/tasks/assign', {
|
||||
data: {id: editedTaskId, member_id: memberId}
|
||||
});
|
||||
};
|
||||
|
||||
export const unassignMemberAPI = async (updateData) => {
|
||||
return axios.put('/api/boards/categories/tasks/unassign', updateData);
|
||||
export const unassignMemberAPI = async (editedTaskId, memberId) => {
|
||||
return axios.put('/api/boards/categories/tasks/unassign', {
|
||||
data: {id: editedTaskId, member_id: memberId}
|
||||
});
|
||||
};
|
||||
|
||||
export const addMemberAPI = async (updateData) => {
|
||||
return axios.post('/api/boards/members/add', updateData);
|
||||
export const addMemberAPI = async (boardId, username) => {
|
||||
return axios.post('/api/boards/members/add', {
|
||||
data: {username: username, board_id: boardId}
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteMemberAPI = async (memberUsername) => {
|
||||
export const deleteMemberAPI = async (boardId, username) => {
|
||||
return axios.delete('/api/boards/members/delete', {
|
||||
data: { id: memberUsername }
|
||||
data: {username: username, board_id: boardId}
|
||||
});
|
||||
};
|
||||
|
||||
export const quitMemberAPI = async () => {
|
||||
return axios.delete('/api/boards/members/quit');
|
||||
export const quitMemberAPI = async (boardId) => {
|
||||
return axios.delete('/api/boards/members/quit', {
|
||||
data: {board_id: boardId}
|
||||
});
|
||||
};
|
||||
|
||||
export const updateBoardsAPI = async (updateData) => {
|
||||
return axios.put('/api/boards/update', updateData);
|
||||
export const updateBoardsAPI = async (editedBoardId, editedBoardMethod, editedBoardValue) => {
|
||||
return axios.put('/api/boards/update', {
|
||||
data: {id: editedBoardId, update_method: editedBoardMethod, value: editedBoardValue}
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteBoardsAPI = async (boardId) => {
|
||||
return axios.delete('/api/boards/delete', {
|
||||
data: { id: boardId }
|
||||
data: {id: boardId}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user