aboutsummaryrefslogtreecommitdiff
path: root/src/ToDo-UI/NewToDo.jsx
diff options
context:
space:
mode:
authorAdrián Oliva <adrian.oliva@cimat.mx>2023-05-27 14:41:28 -0600
committerAdrián Oliva <adrian.oliva@cimat.mx>2023-05-27 14:41:28 -0600
commit127656f9035e0f363f0a48f6d3307084287b8089 (patch)
treed1e8be7357d84d50332b0e8f52c9d279143db645 /src/ToDo-UI/NewToDo.jsx
parentd0d271cdd1fbe5ff3fbe9a50adeb87733eeb4420 (diff)
downloadToDo-App-FE-127656f9035e0f363f0a48f6d3307084287b8089.tar.gz
ToDo-App-FE-127656f9035e0f363f0a48f6d3307084287b8089.zip
New to do now communicates to API.
WE'RE DOING IT!!!!
Diffstat (limited to '')
-rw-r--r--src/ToDo-UI/NewToDo.jsx9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ToDo-UI/NewToDo.jsx b/src/ToDo-UI/NewToDo.jsx
index e81cb4e..8c926b2 100644
--- a/src/ToDo-UI/NewToDo.jsx
+++ b/src/ToDo-UI/NewToDo.jsx
@@ -7,6 +7,8 @@ import {
select_last_index,
} from "../features/todo/reducer";
+import { new_todo_function } from "../api/axios_methods";
+
function new_button(trigger_id) {
return (
<div className="container mt-3 mb-3">
@@ -44,6 +46,8 @@ export function NewToDo() {
const [new_due_date, set_new_due_date] = useState("");
const [new_priority, set_new_priority] = useState("Low");
+ const new_todo_api = new_todo_function();
+
function handle_exit_modal() {
// https://stackoverflow.com/questions/27826381/clearing-form-input-fields-in-bootstrap
$("form").get(0).reset(); // Reset form
@@ -53,6 +57,11 @@ export function NewToDo() {
set_new_priority("Low");
}
function handle_add_todo() {
+ new_todo_api({
+ text: new_text,
+ due_date: new_due_date,
+ priority: new_priority,
+ });
dispatch(
add_todo({
text: new_text,