Fix didn't seem to work.
This commit is contained in:
@@ -22,7 +22,8 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="card-text">Once you delete a bulletin, there is no going back. Please be certain.</p>
|
||||
<button type="button" class="btn btn-danger" onclick="deleteBulletin({{ bulletin.id }}, '{{ bulletin.subject | e }}')">
|
||||
<button type="button" class="btn btn-danger"
|
||||
onclick="deleteBulletin({{ bulletin.id }}, {{ bulletin.subject | tojson }})">
|
||||
Delete This Bulletin Permanently
|
||||
</button>
|
||||
</div>
|
||||
@@ -30,13 +31,16 @@
|
||||
|
||||
<script>
|
||||
async function deleteBulletin(id, subject) {
|
||||
console.log("Clicked delete!")
|
||||
if (!confirm(`Permanently delete bulletin "${subject}"? This cannot be undone.`)) return;
|
||||
console.log("Delete clicked for bulletin " + id);
|
||||
if (!confirm(`Permanently delete bulletin "${subject}"? This cannot be undone.`)) {
|
||||
return;
|
||||
}
|
||||
const response = await fetch(`/api/v1/bulletins/${id}`, { method: 'DELETE' });
|
||||
if (response.ok) {
|
||||
window.location.href = '/bulletins';
|
||||
} else {
|
||||
alert('Delete failed: ' + (await response.text() || 'Unknown error'));
|
||||
const errorText = await response.text();
|
||||
alert('Delete failed: ' + (errorText || 'Unknown error'));
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user