Fix wish not deleting

This commit is contained in:
grandeljay 2022-11-28 12:13:36 +01:00
parent e3a02ca289
commit 9bcf34685b
4 changed files with 21 additions and 17 deletions

View file

@ -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;
}
break;
}

View file

@ -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}',
);
?>

View file

@ -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;
}
});

View file

@ -138,7 +138,10 @@ class Wish
switch ($this->style) {
case 'list':
?>
<div class="ui horizontal card">
<div class="ui horizontal card"
data-id="<?= $this->id ?>"
data-cache="<?= $generateCache ?>"
>
<?= $this->getCardImage() ?>
<div class="content">