We have delete now. Last thing is insert.

This commit is contained in:
Zed A. Shaw 2025-07-27 02:38:08 -04:00
parent 504433502a
commit ea3b59129f
2 changed files with 21 additions and 2 deletions

View file

@ -1,5 +1,16 @@
<script>
let Data = new GetJson("/api/admin/table/{{ .Table }}/{{ .Id }}/");
const ConfirmDelete = async (table, obj_id) => {
if(confirm("Are you sure?")) {
await fetch("/api/admin/table/" + table + "/" + obj_id + "/",
{ method: "DELETE" });
window.location = "/admin/table/" + table + "/";
} else {
console.log("NOOOOO");
return false;
}
}
</script>
<blockstart>
@ -19,9 +30,9 @@
</middle>
<bottom>
<button-group>
<button type="button">Back</button>
<button type="button"><a href="/admin/table/{{ .Table }}/">Back</a></button>
<button type="submit">Update</button>
<button type="button" @click.prevent="console.log('DELETE', item.id)">Delete</button>
<button type="button" @click.prevent="ConfirmDelete('{{ .Table }}', item.id)">Delete</button>
</button-group>
</bottom>
</card>