import React, {useState} from "react";
import {useHttp} from "./usehttp";
function App()
{
const {request} = useHttp()
const [userName, setUsername] = useState('');
const [Password, setPassword] = useState('');
const authPost = async () => {
try {
const data = await request('/api/auth/login', 'POST', {username: userName, password: Password})
} catch (e) {
}
}
return (
<form>
<h1>Авторизация</h1>
<h2><input type="text" name="userName" placeholder="Логин" onChange={e => setUsername(e.target.value)}/>
</h2>
<h2><input type="text" pass="Password" placeholder="Пароль" onChange={e => setPassword(e.target.value)}/>
</h2>
<button onClick={authPost}>
Авторизоваться
</button>
</form>
)
}
export default App;