blob: 54054328f89b6a590240fdecd72ca5e90358a2ee (
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
|
import {useState} from 'react'
import useUser from 'hooks/useUser'
import submitForm from 'helpers/submitForm'
import {Layout, Form, Splash} from 'components'
const Register = () => {
const [errorMsg, setErrorMsg] = useState('')
const [loading, setLoading] = useState(false)
const {mutateUser} = useUser({
redirectToVerify: true,
})
const handleSubmit = async e => {
setLoading(true)
await submitForm(e, '/api/register', mutateUser, setErrorMsg)
setLoading(false)
}
return (
<Layout>
{loading
? <Splash fixed />
: (
<Form
errorMessage={errorMsg}
onSubmit={handleSubmit}
/>
)}
</Layout>
)
}
export default Register
|