diff --git a/src/api/wishes.php b/src/api/wishes.php index 3875d66d..95376f13 100644 --- a/src/api/wishes.php +++ b/src/api/wishes.php @@ -294,15 +294,16 @@ switch ($_SERVER['REQUEST_METHOD']) { break; case 'DELETE': - parse_str(file_get_contents('php://input'), $_DELETE); + $_DELETE = $this->input; if (isset($_DELETE['wish_id'])) { $database->query( 'DELETE FROM `wishes` WHERE `id` = ' . Sanitiser::getNumber($_DELETE['wish_id']) . ';' ); + + $response['success'] = true; } - $response['success'] = true; break; } diff --git a/src/assets/js/inline.js.php b/src/assets/js/inline.js.php index 6e933fd8..332d3729 100644 --- a/src/assets/js/inline.js.php +++ b/src/assets/js/inline.js.php @@ -162,7 +162,7 @@ global $options; 'get wishlists by priority' => '/?page=api&module=wishlists&style={style}&wishlist_id={wishlistid}&priority={priority}', 'delete wishlist' => '/?page=api&module=wishlists', 'update wish status' => '/?page=api&module=wishes', - 'delete wish' => '/?page=api&module=wishes', + 'delete wish' => '/?page=api&module=wishes&wish_id={wishid}', ); ?> diff --git a/src/assets/js/parts/wishlists.js b/src/assets/js/parts/wishlists.js index 32d3c81a..8b07b48e 100644 --- a/src/assets/js/parts/wishlists.js +++ b/src/assets/js/parts/wishlists.js @@ -527,13 +527,19 @@ $(function () { * Delete wish */ buttonDelete.api({ - action : 'delete wish', - method : 'DELETE', - data : { - 'wish_id' : card.attr('data-id'), + 'action' : 'delete wish', + 'method' : 'DELETE', + 'beforeSend' : function (settings) { + var wish_id = card.attr('data-id'); + + settings.urlData.wishid = wish_id; + + console.log(wish_id); + + return settings; }, - on : 'now', - onSuccess : function () { + 'on' : 'now', + 'onSuccess' : function () { column.fadeOut(800); $('body').toast({ message: wishthis.strings.toast.wish.delete }); @@ -541,17 +547,11 @@ $(function () { modalDefault.modal('hide'); setTimeout(() => { - $('.ui.dropdown.wishlists').api('query'); + $('.ui.dropdown.filter.priority').api('query'); }, 800); }, }); - /** - * Return false is currently not working. - * - * @version 2.8.8 - * @see https://github.com/fomantic/Fomantic-UI/issues/2105 - */ return false; } }); diff --git a/src/classes/wish.php b/src/classes/wish.php index c8bca953..8061f678 100644 --- a/src/classes/wish.php +++ b/src/classes/wish.php @@ -138,7 +138,10 @@ class Wish switch ($this->style) { case 'list': ?> -