aboutsummaryrefslogtreecommitdiff
path: root/src/api/axios_methods.js
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/api/axios_methods.js
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/api/axios_methods.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/api/axios_methods.js b/src/api/axios_methods.js
index b9e40dc..c68cc21 100644
--- a/src/api/axios_methods.js
+++ b/src/api/axios_methods.js
@@ -3,7 +3,7 @@ import api from "./axios_config";
// findAll() on Back End.
export function get_todos_function() {
// Get a list of all to dos.
- // GET "/v1/todos"
+ // GET "/todos"
return async (handler) => {
try {
const response = await api.get("/todos");
@@ -13,3 +13,20 @@ export function get_todos_function() {
}
};
}
+
+// addToDo() on Back End.
+export function new_todo_function() {
+ // Add a new to do on database.
+ // POST "/todos"
+ return async (data) => {
+ try {
+ await api.post("/todos", {
+ text: data.text,
+ dueDate: data.due_date,
+ priority: data.priority,
+ });
+ } catch (err) {
+ console.log(err);
+ }
+ };
+}