Skip to content

Commit

Permalink
Merge pull request #87 from PetroShutak/fixed-bugs
Browse files Browse the repository at this point in the history
Update shoppingListService.js
  • Loading branch information
PetroShutak authored May 14, 2023
2 parents d1fad9c + 04610c9 commit 2c73359
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/js/shoppingListService.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ function renderingShoppingList() {
}
}

if (booksArray !== null) {
if (booksArray !== null) {
if (booksArray.length > 0) {
emptyRef.classList.add('visuallyhidden');
}
for (let i = 0; i < booksArray.length; i++) {
const book = loadFromLocalStorage(booksArray[i]._id);
booksList.insertAdjacentHTML(
Expand Down Expand Up @@ -83,19 +86,19 @@ function renderingShoppingList() {
</div>
`
);
}
}
}

const deleteBtnRefs = document.querySelectorAll('.delete-shopping-list-btn');
for (let i = 0; i < deleteBtnRefs.length; i++) {
deleteBtnRefs[i].addEventListener('click', removingBookFromShoppingList);
}

if (!books === 0) {
if (booksArray.length > 0) {
emptyRef.classList.add('visuallyhidden');
}
}
// if (!books === 0) {
// if (booksArray.length > 0) {
// emptyRef.classList.add('visuallyhidden');
// }
// }
}

export async function addingToShopList(e) {
Expand Down

0 comments on commit 2c73359

Please sign in to comment.