This commit is contained in:
arussac
2025-03-10 15:43:22 +01:00
parent 14e3e95054
commit f1dc322a1d
2 changed files with 17 additions and 15 deletions

View File

@@ -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() {

View File

@@ -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;
}
}