Added LoginForm.jsx.
This commit is contained in:
parent
e83b62c01e
commit
4fc4ce9d48
27
frontend/src/components/LoginForm.jsx
Normal file
27
frontend/src/components/LoginForm.jsx
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import React, { useState } from 'react';
|
||||
import axios from 'axios';
|
||||
|
||||
const LoginForm = () => {
|
||||
const [username, setUsername] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
try {
|
||||
const response = await axios.post('/api/auth/login', { username, password });
|
||||
//handle successful login
|
||||
} catch (error) {
|
||||
//handle login error
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit}>
|
||||
<input type="text" value={username} onChange={(e) => setUsername(e.target.value)} placeholder="Username" />
|
||||
<input type="password" value={password} onChange={(e) => setPassword(e.target.value)} placeholder="Password" />
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
);
|
||||
};
|
||||
|
||||
export default LoginForm;
|
||||
Loading…
Reference in New Issue
Block a user