From 2082070fa9d79fe0702441f814f920095d1393c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= Date: Sun, 28 May 2023 14:24:41 -0600 Subject: 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. --- src/api/axios_methods.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/api/axios_methods.js') 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); + } + }; +} -- cgit v1.2.3