Skip to content

Commit

Permalink
Create Login.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 9, 2024
1 parent 4af932b commit 4c13862
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions projects/pi-nexus-iam/src/frontend/components/Login.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React, { useState } from 'react';
import { useDispatch } from 'react-redux';
import { login } from '../actions/auth.actions';

const Login = () => {
const [username, setUsername] = useState('');
const [password, setPassword] = useState('');
const dispatch = useDispatch();

const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
dispatch(login(username, password));
};

return (
<form onSubmit={handleSubmit}>
<label>Username:</label>
<input type="text" value={username} onChange={(event) => setUsername(event.target.value)} />
<br />
<label>Password:</label>
<input type="password" value={password} onChange={(event) => setPassword(event.target.value)} />
<br />
<button type="submit">Login</button>
</form>
);
};

export default Login;

0 comments on commit 4c13862

Please sign in to comment.