From c8fd1b88958ad0a5cd9b87395f9995f0f4176a30 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= <adrian.oliva@cimat.mx>
Date: Sat, 27 May 2023 15:16:18 -0600
Subject: Can now edit to dos on Back End.

---
 src/ToDo-UI/ListToDo.jsx | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'src/ToDo-UI/ListToDo.jsx')

diff --git a/src/ToDo-UI/ListToDo.jsx b/src/ToDo-UI/ListToDo.jsx
index c77c64b..657de44 100644
--- a/src/ToDo-UI/ListToDo.jsx
+++ b/src/ToDo-UI/ListToDo.jsx
@@ -11,6 +11,8 @@ import {
     select_current_sorting,
 } from "../features/todo/reducer";
 
+import { edit_todo_function } from "../api/axios_methods";
+
 function sort_table_header(prefix, current_sorting) {
     if (prefix.toLowerCase().startsWith(current_sorting.substr(0, 3))) {
         switch (current_sorting.substr(-1)) {
@@ -145,6 +147,8 @@ export function ListToDos() {
     const [edit_due_date, set_edit_due_date] = useState("");
     const [edit_priority, set_edit_priority] = useState("Low");
 
+    const edit_todo_api = edit_todo_function();
+
     function handle_open_modal(id, text, due_date, done, priority) {
         set_edit_id(id);
         set_edit_text(text);
@@ -160,6 +164,12 @@ export function ListToDos() {
         set_edit_priority("Low");
     }
     function handle_edit_todo() {
+        edit_todo_api({
+            id: edit_id,
+            text: edit_text,
+            due_date: edit_due_date,
+            priority: edit_priority,
+        });
         dispatch(
             edit_todo({
                 id: edit_id,
-- 
cgit v1.2.3

