From 8d411cbfbc0a350876ac5de7414459316edce9a5 Mon Sep 17 00:00:00 2001 From: Aditya Gannavarapu Date: Sat, 20 Jan 2024 03:44:34 +0530 Subject: [PATCH] Fix logic to disable button --- apps/client/pages/login.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/client/pages/login.tsx b/apps/client/pages/login.tsx index f0f771c4..a2c2dc2b 100644 --- a/apps/client/pages/login.tsx +++ b/apps/client/pages/login.tsx @@ -1,6 +1,6 @@ import { useState, type ReactElement } from 'react' import { FullPageLayout } from '@maybe-finance/client/features' -import { Input, InputPassword, Button, LoadingSpinner } from '@maybe-finance/design-system' +import { Input, InputPassword, Button } from '@maybe-finance/design-system' import { signIn, useSession } from 'next-auth/react' import { useRouter } from 'next/router' import { useEffect } from 'react' @@ -10,7 +10,7 @@ import Link from 'next/link' export default function LoginPage() { const [email, setEmail] = useState('') const [password, setPassword] = useState('') - const [isValid, setIsValid] = useState(true) + const [isValid, setIsValid] = useState(false) const [errorMessage, setErrorMessage] = useState(null) const [isLoading, setIsLoading] = useState(false) @@ -28,7 +28,6 @@ export default function LoginPage() { setErrorMessage(null) setPassword('') setIsLoading(true) - setIsValid(false) const response = await signIn('credentials', { email, @@ -39,7 +38,7 @@ export default function LoginPage() { if (response && response.error) { setErrorMessage(response.error) setIsLoading(false) - setIsValid(true) + setIsValid(false) } } @@ -91,7 +90,7 @@ export default function LoginPage() {