-
Notifications
You must be signed in to change notification settings - Fork 0
Week 2: Michelle & Mindy (Join existing shopping list)
- User enters an existing token
- Show an error if the token does not exist
- Allow them to try again or start a new list
- Save the token to localStorage
- Show the user the existing list
On the onboarding screen, the user can tap to reveal a field where they can enter an existing token. Entering the token and hitting submit saves the token to localStorage, effectively giving them joint control of the list.
- In the iNeedToBuy.xyz example app - there's a "join existing list" link on the original home page
- Will need a "Join" page.
- A field to enter token on join page
-
Will need an error page with linksUsing an alert instead - Will need to edit path in fetchItems and addItem
- The 'happy path' - does this mean not testing when it's an invalid token?
Potentially use a collection within a collection on firebase => path to the collection for a particular token. We're going to study up on localStorage (how to save to & retrieve from). Study up on testing particular pieces of this.
Were able to get the token into localStorage fairly simply, but had a hard time checking if the entered token was in the database. Landed on accessing the database directly and not relying on react-firestore. So added this line to firebase.js
: const db = fb.firestore();
and then was able to put this code in to access the database in the JoinList
component:
db
.collection("lists")
.doc(token)
.get()
.then(function(doc) { function here }
Everything was working correctly in that a valid token added it to localStorage
and an invalid one gave us an alert, but can't tried creating a test to check that an alert would pop up when an invalid token was received, and can't get that to pass.