From 7d513ea7f0df7e295f8fd8ebe5d202530199f924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= Date: Mon, 29 May 2023 22:54:18 -0600 Subject: New Average time added. It displays the time in average of completing to dos. --- src/api/axios_methods.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/api') diff --git a/src/api/axios_methods.js b/src/api/axios_methods.js index bea8b79..90e8a03 100644 --- a/src/api/axios_methods.js +++ b/src/api/axios_methods.js @@ -149,3 +149,17 @@ export function get_last_id_function() { } }; } + +// getAverageTime(). +export function get_average_time_function() { + // Retrieve the average time to complete the to dos, given a priority. + // GET "/todos/average/{priority}" + return async (handler, priority) => { + try { + const response = await api.get(`/todos/average/${priority}`); + handler(response.data); + } catch (err) { + console.log(err); + } + }; +} -- cgit v1.2.3