the-collab-lab / tcl-28-smart-shopping-list

1 stars 3 forks source link

As a developer, I want to refactor how to add a new token to the database so that it is an object instead of a string #26

Open isaabutaa opened 3 years ago

isaabutaa commented 3 years ago

In our Home component, we are adding new tokens to the database like so:

const createToken = async () => { const token = getToken(); localStorage.setItem('token', token); await firestore.collection('tokens').doc(token).set({}); history.push('/list'); };

Per our discussion during office hours on 7/29, we could refactor this code slightly so that instead of adding the token as a standalone string to the database, we could add it as an object to the database with a token property. Something like this:

const tokenTemplate = { token: token }

Note: Please ask questions if this doesn't make sense! Not sure this is clear 😅