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

Component to provide Firebase Auth #24

Open
sampl opened this issue Jun 6, 2018 · 1 comment
Open

Component to provide Firebase Auth #24

sampl opened this issue Jun 6, 2018 · 1 comment

Comments

@sampl
Copy link
Contributor

sampl commented Jun 6, 2018

I know this isn't a Firestore request, but I'm guessing a lot of people who use this package would appreciate a component with a similar API to expose the state of Firebase Auth. (I know I would.)

Sample usage:

import { FirebaseAuth } from 'react-firestore'

<FirebaseAuth>
  { ({error, isLoading, auth}) => {
    if (error) {
      return 'error logging you in'
    }
    if (isLoading) {
      return 'loading account...'
    }
    if (!auth) {
      return <LoginButton />
    } else {
      return <UserSummary user={auth} />
    }
  }}
</FirebaseAuth>

Something like this could work: https://github.com/sampl/firefly/blob/master/src/data/AuthProvider.js

What do you think @green-arrow?

@cdock1029
Copy link

I've been working on something along these lines.. a WIP

https://gist.github.com/cdock1029/a98534ff160692177ac90c6e371cdc68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants