From 4c1386274440b5901f29c6ed6ac09be1b312f701 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Fri, 9 Aug 2024 07:58:39 +0700 Subject: [PATCH] Create Login.tsx --- .../src/frontend/components/Login.tsx | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/pi-nexus-iam/src/frontend/components/Login.tsx diff --git a/projects/pi-nexus-iam/src/frontend/components/Login.tsx b/projects/pi-nexus-iam/src/frontend/components/Login.tsx new file mode 100644 index 000000000..dc4f7ae70 --- /dev/null +++ b/projects/pi-nexus-iam/src/frontend/components/Login.tsx @@ -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) => { + event.preventDefault(); + dispatch(login(username, password)); + }; + + return ( +
+ + setUsername(event.target.value)} /> +
+ + setPassword(event.target.value)} /> +
+ +
+ ); +}; + +export default Login;