import {useEffect, useState} from 'react'
import {signIn} from 'next-auth/client'
import {useRouter} from 'next/router'
import Link from 'next/link'
import {
Box,
Button,
Container,
FormControl,
IconButton,
Input,
InputAdornment,
InputLabel,
LinearProgress,
Snackbar,
Typography
} from '@material-ui/core'
import {Visibility, VisibilityOff} from '@material-ui/icons'
import MuiAlert from '@material-ui/lab/Alert'
import {validateEmail} from '../../lib/utils/emails'
function Alert(props) {
return
}
function Koneksyon() {
const [loginError, setError] = useState('')
const [credentials, setCredentials] = useState({username: '', password: ''})
const [showPassword, setShowPassword] = useState(false)
const [loading, setLoading] = useState(false)
const [open, setOpen] = useState(true)
const router = useRouter()
const handleUpdate = update => {
setCredentials({...credentials, ...update})
}
const handleClick = async () => {
setLoading(true)
const response = await signIn('credentials', {
redirect: false,
...credentials
})
if (response.error) {
setError(response.error)
setLoading(false)
} else if (response.ok) {
setLoading(false)
router.push('/soumet')
}
}
const handleClose = (event, reason) => {
if (reason === 'clickaway') {
return
}
setOpen(false)
setError('')
}
useEffect(() => {
if (loginError) {
setOpen(true)
}
return () => {
setLoading(false)
}
}, [loginError])
const handleClickShowPassword = () => {
setShowPassword(!showPassword)
}
const handleMouseDownPassword = event => {
event.preventDefault()
}
return (
Soumèt an tèks
(soumettre un texte)
Email
handleUpdate({username: event.target.value})}
/>
Mot de passe
{showPassword ? : }
}
onChange={event => handleUpdate({password: event.target.value})}
/>
{loading && }
Pour obtenir un accès, faites-en la demande
📩
kontak@o-k-i.net
{loginError && (
{loginError}
)}
)
}
export default Koneksyon