Closed zeeatwork closed 3 years ago
Visit the preview URL for this PR (updated for commit d1372e4):
https://tcl-23-shopping-list--pr27-za-ar-delete-items-8g2p0cgw.web.app
(expires Wed, 19 May 2021 21:51:10 GMT)
🔥 via Firebase Hosting GitHub Action 🌎
Description
This pull request updates our UI and Firestore database functionality.
List.js
now includes additional event handling that allows a user to delete a shopping list item. The newly createddeleteItem
function takes a list item's id as its only parameter, asks the user to confirm their decision to delete an item, then uses the id to delete the item from it's Firestore collection (using Firestore'sdelete()
method.Read more about implementing the delete method in Firestore here.
Note that, in Firestore, a collection cannot exist without at least one child document. If the user deletes all items from their list, the token disappears from Firestore, but remains in
localstorage
. The list view also reverts to the UI prompt directing the user to add their first item. When the user adds a new item to the list, the user's token reappears in Firestore without issue or error.In order to contemplate accessibility features, we switched our app to the updated version of Sweet Alert and updated the alerts in all our pages.
Acceptance Criteria
Related Issue
This PR closes #12
Type of Changes
Updates
Before
After
Testing Steps / QA Criteria
za-ar-delete-items
npm install
in order to install the new dependencynpm start
the branch using CLITODOS