import React from 'react'; import { authService } from '../services/auth_service'; import { useAuthState } from 'react-firebase-hooks/auth'; import { auth } from '../services/firebase'; export function Login() { const [user, loading, error] = useAuthState(auth); const handleGoogleSignIn = async () => { try { await authService.signInWithGoogle(); } catch (error) { console.error('Login failed:', error); } }; const handleSignOut = async () => { try { await authService.signOut(); } catch (error) { console.error('Logout failed:', error); } }; if (loading) { return (
Loading...
Error: {error.message}
{user.displayName}
{user.email}