Skip to content

Instantly share code, notes, and snippets.

@koss-lebedev
Last active July 10, 2022 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koss-lebedev/49c7a0d5c65190224e327f0640a5dfbd to your computer and use it in GitHub Desktop.
Save koss-lebedev/49c7a0d5c65190224e327f0640a5dfbd to your computer and use it in GitHub Desktop.
import api from '~/common/api'
const LoginForm = () => {
const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
const handleSubmit = async (evt) => {
evt.preventDefault()
await api.login(email, password)
}
return (
<form onSubmit={handleSubmit}>
<input type="email" value={email} onChange={e => setEmail(e.target.value)} />
<input type="password" value={password} onChange={e => setPassword(e.target.value)} />
<button type="submit">Log in</button>
</form>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment