-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add item to firestore #20
Conversation
…g-list into mm-qg-feat-addItem
Visit the preview URL for this PR (updated for commit 765164b): https://tcl-79-smart-shopping-list--pr20-mm-qg-feat-additem-o0v3zun6.web.app (expires Sat, 31 Aug 2024 11:25:34 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: d91d9ddbda780208241c52942f544acf8e81407a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing I would suggest is removing the console.log statements other than that well done! 👏
Looks great guys! Well done 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything works as expected, great work team! I left only a small note
src/api/firebase.js
Outdated
// TODO: Replace this call to console.log with the appropriate | ||
// Firebase function, so this information is sent to your database! | ||
return console.log(listCollectionRef, { | ||
const newItemEntry = doc(listCollectionRef); | ||
return setDoc(newItemEntry, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because we are not trying to update items here, it would be better to use the addDoc
function instead of setDoc
. (it takes the listCollectionRef directly, you won't need const newItemEntry = doc(listCollectionRef);
)
Also, you can remove these comments as you already replaced console.log
…dating existing items - Delete comments referring to previous console.log usage
Description
New feature: Add new item to list by saving it to Firestore.
Used a single useState for the form data.
Related Issue
Closes #5
Acceptance Criteria
UI-related tasks:
ManageList
view displays a form that allows them to enter the name of the item and select how soon they anticipate needing to buy it again. There should be 3 choices for this:label
element associated with itEnter
keyData-related tasks:
console.log
in theaddItem
function insrc/api/firebase.js
is replaced with a function that adds the new document to the Firestore database. That function will be imported from thefirebase/firestore
module.nextPurchasedDate
Type of Changes
feature
Updates
Before
After
Testing Steps / QA Criteria
git pull
andgit checkout mm-jo-rendered-list
.npm start
.ManageList
.