From c8fd1b88958ad0a5cd9b87395f9995f0f4176a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= Date: Sat, 27 May 2023 15:16:18 -0600 Subject: Can now edit to dos on Back End. --- src/api/axios_methods.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/api') 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); + } + }; +} -- cgit v1.2.3