From ac4a146682ede7bf661938b78a970d7da8bd868a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= Date: Sat, 27 May 2023 15:32:54 -0600 Subject: Delete a specific to do with API. --- src/api/axios_methods.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/api/axios_methods.js') diff --git a/src/api/axios_methods.js b/src/api/axios_methods.js index 68f119f..8748cb7 100644 --- a/src/api/axios_methods.js +++ b/src/api/axios_methods.js @@ -47,3 +47,16 @@ export function edit_todo_function() { } }; } + +// removeToDo(). +export function remove_todo_function() { + // Remove an existing to do by its id. + // DELETE "/todos/{id}" + return async (data) => { + try { + await api.delete(`/todos/${data.id}`); + } catch (err) { + console.log(err); + } + }; +} -- cgit v1.2.3