IjzerenHein / firestorter

Use Google Firestore in React with zero effort, using MobX 🤘
http://firestorter.com
MIT License
378 stars 50 forks source link

how to use my uid ? #79

Closed ofersarid closed 4 years ago

ofersarid commented 5 years ago

Hi, I have some collections and documents that are restricted by permission. the user's uid is validated against the permissions. how can i use my uid with firestorere ?

IjzerenHein commented 5 years ago

Hi, I guess what you're asking is how to set your collection queries to query only documents for the logged in user. Please have a look at this section of the docs: https://github.com/IjzerenHein/firestorter/blob/master/docs/Queries.md#disabling-the-collection-from-within-a-query

What you can do is once the login credentials are obtained (which is outside the scope of Firestorter, which only focuses on Firestore collections and documents), is to store the user-id in a observable. You can then use that observable in a collection query.