import { useState } from 'react' import FormErrors from '../components/FormErrors' import { login } from '../lib/allauth' import { Link } from 'react-router-dom' import { useConfig } from '../auth' import ProviderList from '../socialaccount/ProviderList' import Button from '../components/Button' import WebAuthnLoginButton from '../mfa/WebAuthnLoginButton' export default function Login () { const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [response, setResponse] = useState({ fetching: false, content: null }) const config = useConfig() const hasProviders = config.data.socialaccount?.providers?.length > 0 function submit () { setResponse({ ...response, fetching: true }) login({ email, password }).then((content) => { setResponse((r) => { return { ...r, content } }) }).catch((e) => { console.error(e) window.alert(e) }).then(() => { setResponse((r) => { return { ...r, fetching: false } }) }) } return (
No account? Sign up here.