From 6a37cd9cc4887b58d54bb599254fbef56e737d87 Mon Sep 17 00:00:00 2001 From: aundus Date: Wed, 19 May 2021 11:28:23 -0400 Subject: [PATCH] fix bookId reference --- templates/bibrec.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/bibrec.html b/templates/bibrec.html index 2234281..c3b58b1 100644 --- a/templates/bibrec.html +++ b/templates/bibrec.html @@ -393,7 +393,7 @@ Gutenberg metadata much faster than by scraping. try{ const bookData = getBookMetadata(); const newList = { ...JSON.parse(localStorage.getItem('booklist')) } - newList[bookId] = bookData + newList[bookData.bookId] = bookData addbtn.classList.add('book-in-list') addbtn.innerHTML = '-' @@ -409,8 +409,9 @@ Gutenberg metadata much faster than by scraping. } function removeBook () { + const bookData = getBookMetadata(); const newlist = JSON.parse(localStorage.getItem('booklist')) - delete newlist[bookId] + delete newlist[bookData.bookId] localStorage.setItem('booklist', JSON.stringify(newlist)) console.log(localStorage.getItem('booklist')) addbtn.classList.remove('book-in-list')