aboutsummaryrefslogtreecommitdiff
path: root/src/ToDo-UI/ListToDo.jsx
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/ToDo-UI/ListToDo.jsx
parent127656f9035e0f363f0a48f6d3307084287b8089 (diff)
downloadToDo-App-FE-c8fd1b88958ad0a5cd9b87395f9995f0f4176a30.tar.gz
ToDo-App-FE-c8fd1b88958ad0a5cd9b87395f9995f0f4176a30.zip
Can now edit to dos on Back End.
Diffstat (limited to 'src/ToDo-UI/ListToDo.jsx')
-rw-r--r--src/ToDo-UI/ListToDo.jsx10
1 files changed, 10 insertions, 0 deletions
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,