import { useEffect } from 'react'; import LoginForm from './LoginForm'; import { useAuthContext } from '~/hooks/AuthContext'; import { useNavigate } from 'react-router-dom'; import { useGetStartupConfig } from '~/data-provider'; function Login() { const { login, error, isAuthenticated } = useAuthContext(); const { data: startupConfig } = useGetStartupConfig(); const navigate = useNavigate(); useEffect(() => { if (isAuthenticated) { navigate('/chat/new'); } }, [isAuthenticated, navigate]); return (

Welcome back

{error && (
Unable to login with the information provided. Please check your credentials and try again.
)} {startupConfig?.registrationEnabled && (

{' '} Don't have an account?{' '} Sign up

)} {startupConfig?.googleLoginEnabled && ( <>
Or

Login with Google

)} {startupConfig?.openidLoginEnabled && ( <>
{startupConfig.openidImageUrl ? ( OpenID Logo ) : ( )}

{startupConfig.openidLabel}

)}
); } export default Login;