blob: e7fee15296d16ddedad04f10612afed250d33700 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import { useState } from 'react'
import useUser from 'hooks/useUser'
import submitForm from 'helpers/submitForm'
import { Layout, Form, Splash } from 'components'
const Login = () => {
const [errorMsg, setErrorMsg] = useState('')
const [loading, setLoading] = useState(false)
const { mutateUser } = useUser({
redirectToVerify: true,
redirectToApps: true
})
const handleSubmit = async e => {
setLoading(true)
await submitForm(e, '/api/login', mutateUser, setErrorMsg)
setLoading(false)
}
return (
<Layout>
{loading
? <Splash fixed />
: (
<Form
isLogin
errorMessage={errorMsg}
onSubmit={handleSubmit}
/>
)}
</Layout>
)
}
export default Login
|