Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.

Commit ec44ec0

Browse files
committed
gallery: fix deleting images
1 parent 04976b4 commit ec44ec0

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/js/photoinit.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,25 @@ function initPhotoSwipeFromDOM(gallerySelector) {
196196
const msg = i18n('really_delete_image');
197197
const really = confirm(img + ' ' + msg);
198198
if (really) {
199-
photoBooth.deleteImage(img, (data) => {
200-
if (data.success) {
201-
console.log('Deleted ' + img);
202-
photoBooth.reloadPage();
203-
} else {
204-
console.log('Error while deleting ' + img);
199+
$.ajax({
200+
url: 'api/deletePhoto.php',
201+
method: 'POST',
202+
data: {
203+
file: img
204+
},
205+
success: (data) => {
206+
if (data.success) {
207+
console.log('Deleted ' + img);
208+
photoBooth.reloadPage();
209+
} else {
210+
console.log('Error while deleting ' + img);
211+
setTimeout(function () {
212+
photoBooth.reloadPage();
213+
}, 5000);
214+
}
215+
},
216+
error: (jqXHR, textStatus) => {
217+
console.log('Error while deleting image: ', textStatus);
205218
setTimeout(function () {
206219
photoBooth.reloadPage();
207220
}, 5000);

0 commit comments

Comments
 (0)