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