- commit
- fb244df285c69867dfe50d9131ab25505a8b06f1
- parent
- 13fb1e81ed10a826560fe7fe46821651e22cf318
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2026-11-07 07:49
broadcast reset before delete
Diffstat
| M | static/pad.js | 16 | ++++++++++++---- |
1 files changed, 12 insertions, 4 deletions
diff --git a/static/pad.js b/static/pad.js
@@ -125,11 +125,19 @@ el.addEventListener('input', function() {
125 125 });
126 126
127 127 document.querySelector('button').addEventListener('click', function() {
128 -1 if (confirm('Are you sure you want to delete all data?')) {
129 -1 return fetch(url, {method: 'DELETE'}).then(() => {
130 -1 location.reload();
131 -1 });
-1 128 if (!confirm('Are you sure you want to delete all data?')) {
-1 129 return;
132 130 }
-1 131
-1 132 var data = [id, 'changes', [diff.diff('', '', 3)]];
-1 133 return fetch(url, {
-1 134 method: 'POST',
-1 135 body: JSON.stringify(data),
-1 136 }).then(() => {
-1 137 return fetch(url, {method: 'DELETE'});
-1 138 }).then(() => {
-1 139 location.reload();
-1 140 });
133 141 });
134 142
135 143 var eventSource = new EventSource(url);