From f1dc322a1d78254bfcd9e6ea1a3442348fb4df3b Mon Sep 17 00:00:00 2001 From: arussac Date: Mon, 10 Mar 2025 15:43:22 +0100 Subject: [PATCH] =?UTF-8?q?=C3=A0=20jour?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/index.js | 4 +++- js/utilities/routes.js | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/js/index.js b/js/index.js index 936b3e7..f04b80c 100644 --- a/js/index.js +++ b/js/index.js @@ -85,7 +85,9 @@ function display_projects() { document.getElementById('okBtn').onclick = function() { document.getElementById('customAlert').style.display = 'none'; // Call your delete function here - deleteProject(global_project_list[i].id); + deleteProject(global_project_list[i].id).then(()=>{ + location.reload(); + }) }; document.getElementById('cancelBtn').onclick = function() { diff --git a/js/utilities/routes.js b/js/utilities/routes.js index b8f388d..c9aeb41 100644 --- a/js/utilities/routes.js +++ b/js/utilities/routes.js @@ -62,7 +62,7 @@ async function getDataProjectVideosFromApi(id) { // If the request is successful, store the data in the cache and return it return response; } catch (error) { - console.error("Error fetching data:", error); + alert("Error fetching data:", error); throw error; // Re-throw the error to handle it outside the function if needed } } @@ -77,7 +77,7 @@ async function getDataVideoFromApi(id) { // If the request is successful, store the data in the cache and return it return response; } catch (error) { - console.error("Error fetching data:", error); + alert("Error fetching data:", error); throw error; // Re-throw the error to handle it outside the function if needed } } @@ -101,9 +101,9 @@ async function postNewVideo(project_id, measurements_id, name_video, resolution, data: mydata }); - console.log("Video posted successfully:", response); + alert("Video posted successfully:", response); } catch (error) { - console.error("Error posting video:", error); + alert("Error posting video:", error); throw error; } } @@ -124,9 +124,9 @@ async function PostNewProject(nameProject, description){ data: mydata }); - console.log("Video posted successfully:", response); + alert("Video posted successfully:", response); } catch (error) { - console.error("Error posting video:", error); + alert("Error posting video:", error); throw error; } } @@ -140,7 +140,7 @@ async function deleteProject(id){ alert("Projet supprimé avec succès") }) } catch (error) { - console.error("Error deleting project, project id :"+ id+"\n error :"+error); + alert("Error deleting project, project id :"+ id+"\n error :"+error); throw error; } } @@ -153,7 +153,7 @@ async function deleteVideo(id){ alert("Video supprimé avec succès") }) } catch (error) { - console.error("Error deleting video, video id :"+ id+"\n error :"+error); + alert("Error deleting video, video id :"+ id+"\n error :"+error); throw error; } } @@ -171,9 +171,9 @@ async function renderVideo(id){ data: mydata }); - console.log("Video rendered successfully:", response); + alert("Video rendered successfully:", response); } catch (error) { - console.error("Error rendering video:", error); + alert("Error rendering video:", error); throw error; } } @@ -193,9 +193,9 @@ async function start_timelapse(id,frequency){ data: mydata }); - console.log("data retrieval started:", response); + alert("data retrieval started:", response); } catch (error) { - console.error("Error starting the retrieval:", error); + alert("Error starting the retrieval:", error); throw error; } } @@ -213,9 +213,9 @@ async function stopCamera(id){ data: mydata }); - console.log("Camera stopped succesfully :", response); + alert("Camera stopped succesfully :", response); } catch (error) { - console.error("Error stopping the camera :", error); + alert("Error stopping the camera :", error); throw error; } } \ No newline at end of file