aboutsummaryrefslogtreecommitdiff
path: root/src/api/axios_methods.js
diff options
context:
space:
mode:
authorAdrián Oliva <adrian.oliva@cimat.mx>2023-05-27 15:16:18 -0600
committerAdrián Oliva <adrian.oliva@cimat.mx>2023-05-27 15:16:18 -0600
commitc8fd1b88958ad0a5cd9b87395f9995f0f4176a30 (patch)
tree0d0078410662602f4c1c03f4457fd0e12b649359 /src/api/axios_methods.js
parent127656f9035e0f363f0a48f6d3307084287b8089 (diff)
downloadToDo-App-FE-c8fd1b88958ad0a5cd9b87395f9995f0f4176a30.tar.gz
ToDo-App-FE-c8fd1b88958ad0a5cd9b87395f9995f0f4176a30.zip
Can now edit to dos on Back End.
Diffstat (limited to '')
-rw-r--r--src/api/axios_methods.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/api/axios_methods.js b/src/api/axios_methods.js
index c68cc21..68f119f 100644
--- a/src/api/axios_methods.js
+++ b/src/api/axios_methods.js
@@ -30,3 +30,20 @@ export function new_todo_function() {
}
};
}
+
+// editToDo() on BE.
+export function edit_todo_function() {
+ // Edit an existing to do.
+ // PUT "/todos/{id}"
+ return async (data) => {
+ try {
+ await api.put(`/todos/${data.id}`, {
+ text: data.text,
+ dueDate: data.due_date,
+ priority: data.priority,
+ });
+ } catch (err) {
+ console.log(err);
+ }
+ };
+}