Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete Item #29

Merged
merged 1 commit into from
Sep 20, 2024
Merged

Delete Item #29

merged 1 commit into from
Sep 20, 2024

Conversation

MarcosPerez16
Copy link
Collaborator

Description

Added delete button and implemented a function. Created a confirm window for the user upon deleting item. Filled out deleteItem function in firebase

The code adds a delete button and deleteItem function as well as a prompt asking if the user would like to delete the item. We learned more about how our firebase db structure and layers work.

Related Issue

closes #12

Acceptance Criteria

  • The ListItem component renders a button that allows the user to delete an item from their list when clicked
  • Clicking the delete button prompts the user to confirm that they really want to delete the item
  • The deleteItem function in api/firebase.js has been filled out, and deletes the item from the Firestore database

Type of Changes

feature

After

screenshot for issue 12
Screenshot for issue 12 number 2

Testing Steps / QA Criteria

  1. Go to a list, click on the delete button.
  2. Confirm whether or not you would like to delete
  3. Item should be deleted on screen, and in firebase

…dow for the user upon deleting item. Filled out deleteItem function in firebase

Co-authored-by: EmmaBin <[email protected]>
Copy link

Visit the preview URL for this PR (updated for commit 28ab926):

https://tcl-76-smart-shopping-list--pr29-mp-eb-delete-item-hsao1ss1.web.app

(expires Tue, 24 Sep 2024 17:54:25 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 512b1a88be8ae05fd3e727b99332819df760271d

Copy link
Collaborator

@arandel1 arandel1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and works properly. Nice job!

Copy link
Collaborator

@sar-mko sar-mko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I got the prompt, it deleted on the screen, and updates in firebase.

const [checked, setChecked] = useState(false);

const handleDelete = async () => {
try {
if (window.confirm(`Are you sure you want to delete ${name}?`)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the check here :) and the use of async/await

Copy link
Collaborator

@mentalcaries mentalcaries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice clean implementation. Good job!

@EmmaBin EmmaBin merged commit dd5ebac into main Sep 20, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants