Tried another fix that helped a little. Not there yet.
This commit is contained in:
@@ -91,10 +91,7 @@
|
||||
<a href="/api/v1/objects/{{ obj.uuid }}/text" class="btn btn-sm btn-outline-info me-1" target="_blank">View Text</a>
|
||||
{% endif %}
|
||||
<a href="/api/v1/objects/{{ obj.uuid }}/download" class="btn btn-sm btn-primary me-1">Download</a>
|
||||
<form action="/api/v1/objects/{{ obj.uuid }}" method="post" style="display:inline;" onsubmit="return confirm('Permanently delete {{ obj.name | e }}?');">
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
|
||||
</form>
|
||||
<button type="button" class="btn btn-sm btn-danger" onclick="deleteObject('{{ obj.uuid }}', '{{ obj.name | e }}')">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -104,4 +101,16 @@
|
||||
<p>No objects uploaded yet.</p>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
async function deleteObject(uuid, name) {
|
||||
if (!confirm(`Permanently delete ${name}?`)) return;
|
||||
const response = await fetch(`/api/v1/objects/${uuid}`, { method: 'DELETE' });
|
||||
if (response.ok) {
|
||||
location.reload();
|
||||
} else {
|
||||
alert('Delete failed');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user