fix bookId reference
parent
fbe927d12b
commit
6a37cd9cc4
|
@ -393,7 +393,7 @@ Gutenberg metadata much faster than by scraping.
|
||||||
try{
|
try{
|
||||||
const bookData = getBookMetadata();
|
const bookData = getBookMetadata();
|
||||||
const newList = { ...JSON.parse(localStorage.getItem('booklist')) }
|
const newList = { ...JSON.parse(localStorage.getItem('booklist')) }
|
||||||
newList[bookId] = bookData
|
newList[bookData.bookId] = bookData
|
||||||
|
|
||||||
addbtn.classList.add('book-in-list')
|
addbtn.classList.add('book-in-list')
|
||||||
addbtn.innerHTML = '-'
|
addbtn.innerHTML = '-'
|
||||||
|
@ -409,8 +409,9 @@ Gutenberg metadata much faster than by scraping.
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeBook () {
|
function removeBook () {
|
||||||
|
const bookData = getBookMetadata();
|
||||||
const newlist = JSON.parse(localStorage.getItem('booklist'))
|
const newlist = JSON.parse(localStorage.getItem('booklist'))
|
||||||
delete newlist[bookId]
|
delete newlist[bookData.bookId]
|
||||||
localStorage.setItem('booklist', JSON.stringify(newlist))
|
localStorage.setItem('booklist', JSON.stringify(newlist))
|
||||||
console.log(localStorage.getItem('booklist'))
|
console.log(localStorage.getItem('booklist'))
|
||||||
addbtn.classList.remove('book-in-list')
|
addbtn.classList.remove('book-in-list')
|
||||||
|
|
Loading…
Reference in New Issue