Skip to content

Commit 9affc1e

Browse files
committed
Add update partial of task (patch api)
1 parent b7bb101 commit 9affc1e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

frontend/src/api/TaskApi.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ export const updateTask = (endpoint, id, data) => {
3838
});
3939
};
4040

41+
export const updateTaskPartial = (endpoint, id, data) => {
42+
return axiosInstance
43+
.patch(`${baseURL}${endpoint}/${id}/`, data)
44+
.then((response) => response.data)
45+
.catch((error) => {
46+
throw error;
47+
});
48+
};
49+
4150
export const deleteTask = (endpoint, id) => {
4251
return axiosInstance
4352
.delete(`${baseURL}${endpoint}/${id}/`)
@@ -64,6 +73,7 @@ export const readHabitTaskByID = (id) => readTaskByID("habit", id);
6473

6574
// Update
6675
export const updateTodoTask = (id, data) => updateTask("todo", id, data);
76+
export const updateTodoTaskPartial = (id, data) => updateTaskPartial("todo", id, data);
6777
export const updateRecurrenceTask = (id, data) => updateTask("daily", id, data);
6878
export const updateHabitTask = (id, data) => updateTask("habit", id, data);
6979

0 commit comments

Comments
 (0)