40 lines
823 B
JavaScript
40 lines
823 B
JavaScript
import { useState } from 'react';
|
|
import { setConstantValue } from 'typescript';
|
|
|
|
const App = () => {
|
|
const [email, setEmail] = useState('');
|
|
const [password, setPassword] = useState('');
|
|
|
|
const submit = () => {
|
|
fetch('/sign_in', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({ email, password }),
|
|
});
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<div>
|
|
<input
|
|
type="email"
|
|
value={email}
|
|
onChange={(e) => setEmail(e.target.value)}
|
|
/>
|
|
</div>
|
|
<div>
|
|
<input
|
|
type="password"
|
|
value={password}
|
|
onChange={(e) => setPassword(e.target.value)}
|
|
/>
|
|
</div>
|
|
<button type="button" onClick={submit}>Login</button>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|