fix(phase26): add Pi trip deletion (BUG-08)

This commit is contained in:
Mathieu Moran
2026-08-11 02:07:59 -04:00
parent 786d5b8f3e
commit c5c478bef6
7 changed files with 33 additions and 4 deletions
+2 -1
View File
@@ -182,6 +182,7 @@
const tripList = document.getElementById("trip-list");
const deletable = tripList && tripList.dataset.deletable === "1";
const deleteUrl = (tripList && tripList.dataset.deleteUrl) || "/api/trip/";
function renderTrips(trips) {
body.replaceChildren();
@@ -225,7 +226,7 @@
window.confirmDelete(`Delete trip from ${date}?\n\nThe raw GPS data is kept — only this computed trip record is removed.`)
.then(function(confirmed) {
if (!confirmed) return;
return fetch(`/api/v1/portal/trip/${tripId}`, { method: "DELETE" })
return fetch(deleteUrl + tripId, { method: "DELETE" })
.then(function(res) {
if (!res.ok) throw new Error("Delete failed");
deleteBtn.closest("tr").remove();