aboutsummaryrefslogtreecommitdiff
path: root/src/api/axios_methods.js
diff options
context:
space:
mode:
authorAdrián Oliva <adrian.oliva@cimat.mx>2023-05-28 14:24:41 -0600
committerAdrián Oliva <adrian.oliva@cimat.mx>2023-05-28 14:24:41 -0600
commit2082070fa9d79fe0702441f814f920095d1393c9 (patch)
tree071d24eb3b0d7cf618e3491f3aa132693ea35ba4 /src/api/axios_methods.js
parent117b8c82ef02b95d289cd1ad22f226828918a18b (diff)
downloadToDo-App-FE-2082070fa9d79fe0702441f814f920095d1393c9.tar.gz
ToDo-App-FE-2082070fa9d79fe0702441f814f920095d1393c9.zip
Little bug on last index.
Because the Front End wasn't tracking the deleted items, the indexes between the database and the front end were not matching.
Diffstat (limited to 'src/api/axios_methods.js')
-rw-r--r--src/api/axios_methods.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/api/axios_methods.js b/src/api/axios_methods.js
index ffc0c28..f983157 100644
--- a/src/api/axios_methods.js
+++ b/src/api/axios_methods.js
@@ -86,3 +86,17 @@ export function set_undone_function() {
}
};
}
+
+// giveMeLastID().
+export function get_last_id_function() {
+ // Retrieve last index used.
+ // GET "/todos/lastIndex"
+ return async (handler) => {
+ try {
+ const response = await api.get("/todos/lastIndex");
+ handler(response.data);
+ } catch (err) {
+ console.log(err);
+ }
+ };
+}