Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
return preloadAuth(firebaseApp).then(auth => {
const result = preloadObservable(
user(auth() as firebase.auth.Auth),
'auth: user'
);
return result.request.promise;
});
}