How to use the rxfire/auth.user function in rxfire

To help you get started, we’ve selected a few rxfire examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FirebaseExtended / reactfire / reactfire / auth / index.tsx View on Github external
auth?: auth.Auth,
  options?: ReactFireOptions
): User | T {
  auth = auth || useAuth()();

  let currentUser = undefined;

  if (options && options.startWithValue !== undefined) {
    currentUser = options.startWithValue;
  } else if (auth.currentUser) {
    // if auth.currentUser is undefined or null, we won't use it
    // because null can mean "not signed in" OR "still loading"
    currentUser = auth.currentUser;
  }

  return useObservable(user(auth), 'auth: user', currentUser);
}
github FirebaseExtended / reactfire / reactfire / auth / index.tsx View on Github external
return preloadAuth(firebaseApp).then(auth => {
    const result = preloadObservable(
      user(auth() as firebase.auth.Auth),
      'auth: user'
    );
    return result.request.promise;
  });
}