22 |
Login
23 |
setUsername(e.target.value)}
28 | >
29 |
setPassword(e.target.value)}
34 | >
35 |
36 | {error && JSON.stringify(error)}
37 |
40 |
41 | )
42 | }
43 |
--------------------------------------------------------------------------------
/client/src/pages/Register.tsx:
--------------------------------------------------------------------------------
1 | import { useState } from 'react'
2 | import { useMutation } from 'react-query'
3 | import { useHistory } from 'react-router'
4 | import { ApiError, request } from '../http'
5 |
6 | const register = (data: {
7 | username: string
8 | password: string
9 | email: string
10 | }) => request({ method: 'POST', url: '/register', data })
11 |
12 | export const Register = () => {
13 | const history = useHistory()
14 | const [username, setUsername] = useState('')
15 | const [email, setEmail] = useState('')
16 | const [password, setPassword] = useState('')
17 | const [error, setError] = useState