Remove deleted bookmark from page without refreshing.

This commit is contained in:
voussoir 2021-01-08 18:28:02 -08:00
parent 20a3828dbf
commit 8f0ff55383

View file

@ -59,8 +59,18 @@ function create_bookmark_form()
function delete_bookmark_form(event) function delete_bookmark_form(event)
{ {
const id = event.target.closest(".bookmark_card").dataset.id; const card = event.target.closest(".bookmark_card");
api.bookmarks.delete(id, common.refresh_or_alert); 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; ed_on_open = undefined;