Add enter key up to valid form login
This commit is contained in:
@@ -37,6 +37,10 @@ function Koneksyon() {
|
||||
}
|
||||
|
||||
const handleClick = async () => {
|
||||
if (!validateEmail(credentials.username) || credentials.password === '') {
|
||||
return
|
||||
}
|
||||
|
||||
setLoading(true)
|
||||
const response = await signIn('credentials', {
|
||||
redirect: false,
|
||||
@@ -78,6 +82,12 @@ function Koneksyon() {
|
||||
event.preventDefault()
|
||||
}
|
||||
|
||||
const handleKeyUp = event => {
|
||||
if (event.keyCode === 13) {
|
||||
handleClick()
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Container maxWidth='sm'>
|
||||
<Box align='center'>
|
||||
@@ -97,6 +107,7 @@ function Koneksyon() {
|
||||
type='email'
|
||||
id='email'
|
||||
onChange={event => handleUpdate({username: event.target.value})}
|
||||
onKeyUp={handleKeyUp}
|
||||
/>
|
||||
</FormControl>
|
||||
|
||||
@@ -119,6 +130,7 @@ function Koneksyon() {
|
||||
</InputAdornment>
|
||||
}
|
||||
onChange={event => handleUpdate({password: event.target.value})}
|
||||
onKeyUp={handleKeyUp}
|
||||
/>
|
||||
</FormControl>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user