aboutsummaryrefslogtreecommitdiffstats
path: root/pages/login.js
blob: 3fb2df6e7a05e5bdded7cdd9f4ce64d24bb2a898 (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
import { useState } from 'react'
import useUser from 'lib/useUser'
import submitForm from 'helpers/submitForm'
import {Layout, Form} from 'components'

const Login = () => {
  const {mutateUser} = useUser({
    redirectToVerify: true,
    redirectToApps: true,
  })

  const [errorMsg, setErrorMsg] = useState('')
  const handleSubmit = e => submitForm(e, '/api/login', mutateUser, setErrorMsg)

  return (
    <Layout>
      <Form
        isLogin
        errorMessage={errorMsg}
        onSubmit={handleSubmit}
      />
    </Layout>
  )
}

export default Login