Remove deleted bookmark from page without refreshing.
This commit is contained in:
parent
20a3828dbf
commit
8f0ff55383
1 changed files with 12 additions and 2 deletions
|
@ -59,8 +59,18 @@ function create_bookmark_form()
|
|||
|
||||
function delete_bookmark_form(event)
|
||||
{
|
||||
const id = event.target.closest(".bookmark_card").dataset.id;
|
||||
api.bookmarks.delete(id, common.refresh_or_alert);
|
||||
const card = event.target.closest(".bookmark_card");
|
||||
const id = card.dataset.id;
|
||||
function callback(response)
|
||||
{
|
||||
if (response.meta.status !== 200)
|
||||
{
|
||||
alert(JSON.stringify(response));
|
||||
return;
|
||||
}
|
||||
card.parentElement.removeChild(card);
|
||||
}
|
||||
api.bookmarks.delete(id, callback);
|
||||
}
|
||||
|
||||
ed_on_open = undefined;
|
||||
|
|
Loading…
Reference in a new issue