diff options
author | Adrián Oliva <adrian.oliva@cimat.mx> | 2023-05-27 15:48:23 -0600 |
---|---|---|
committer | Adrián Oliva <adrian.oliva@cimat.mx> | 2023-05-27 15:48:23 -0600 |
commit | c1f97240230ada378d77eeb8db726e0d936169c8 (patch) | |
tree | ec3b573878432099b2aba9adc7cf0116c9b9892b /src/api/axios_methods.js | |
parent | ac4a146682ede7bf661938b78a970d7da8bd868a (diff) | |
download | ToDo-App-FE-c1f97240230ada378d77eeb8db726e0d936169c8.tar.gz ToDo-App-FE-c1f97240230ada378d77eeb8db726e0d936169c8.zip |
Can now set a to do as done or undone.
Diffstat (limited to '')
-rw-r--r-- | src/api/axios_methods.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/api/axios_methods.js b/src/api/axios_methods.js index 8748cb7..ffc0c28 100644 --- a/src/api/axios_methods.js +++ b/src/api/axios_methods.js @@ -60,3 +60,29 @@ export function remove_todo_function() { } }; } + +// setDone(). +export function set_done_function() { + // Set a to do as done. If already done, don't do anything. + // POST "/todos/{id}/done" + return async (data) => { + try { + await api.post(`/todos/${data.id}/done`); + } catch (err) { + console.log(err); + } + }; +} + +// setUndone(). +export function set_undone_function() { + // Set a to do as not done. If it's already not done, don't do anything. + // PUT "/todos/{id}/undone" + return async (data) => { + try { + await api.put(`/todos/${data.id}/undone`); + } catch (err) { + console.log(err); + } + }; +} |