diff --git a/apps/client/pages/login.tsx b/apps/client/pages/login.tsx index aabcc715..a2c2dc2b 100644 --- a/apps/client/pages/login.tsx +++ b/apps/client/pages/login.tsx @@ -12,6 +12,7 @@ export default function LoginPage() { const [password, setPassword] = useState('') const [isValid, setIsValid] = useState(false) const [errorMessage, setErrorMessage] = useState(null) + const [isLoading, setIsLoading] = useState(false) const { data: session } = useSession() const router = useRouter() @@ -26,6 +27,7 @@ export default function LoginPage() { e.preventDefault() setErrorMessage(null) setPassword('') + setIsLoading(true) const response = await signIn('credentials', { email, @@ -35,9 +37,17 @@ export default function LoginPage() { if (response && response.error) { setErrorMessage(response.error) + setIsLoading(false) + setIsValid(false) } } + const onPasswordChange = (e: React.ChangeEvent) => { + setErrorMessage(null) + setPassword(e.target.value) + setIsValid(e.target.value.length > 0) + } + return ( <>