From 4830d2a43277593a01bb1ef107861988dd9c87ec Mon Sep 17 00:00:00 2001 From: IluaAir Date: Wed, 15 Oct 2025 22:43:52 +0300 Subject: [PATCH] tasks create --- taskncoffee-app/src/api/tasks.service.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 taskncoffee-app/src/api/tasks.service.js diff --git a/taskncoffee-app/src/api/tasks.service.js b/taskncoffee-app/src/api/tasks.service.js new file mode 100644 index 0000000..e6e4e9a --- /dev/null +++ b/taskncoffee-app/src/api/tasks.service.js @@ -0,0 +1,22 @@ +import client from './client'; +import { API_ENDPOINTS } from './ApiSources'; + + +/** + * Create a new task + * @param {Object} taskData - Task data + * @param {string} taskData.title - Task title + * @param {string} taskData.description - Task description + * @param {string} taskData.priority - Task priority + * @param {string} taskData.status - Task status + * @param {string} taskData.due_date - Task due date + * @returns {Promise} Created task data + */ +export const createTask = async (taskData) => { + try { + const response = await client.post(API_ENDPOINTS.TASKS.CREATE, taskData); + return response.data; + } catch (error) { + throw error.response?.data || error.message; + } +}; \ No newline at end of file