Login Function added

This commit is contained in:
brausjonas
2023-05-16 19:22:54 +02:00
parent 2da3e62c15
commit bd6ec7b21f
6 changed files with 99 additions and 88 deletions
+36
View File
@@ -0,0 +1,36 @@
import {useState} from "react";
import Button from "@/components/Button";
export default function Login() {
let url = "http://localhost:8080/users"
function on_login_click()
{
url += "?mail=" + inputUserName + "&password=" + inputPassword;
fetch(url, {
method: "GET",
}).then(r => console.log())
}
const [inputUserName, setInputUserName] = useState("")
const [inputPassword, setInputPassword] = useState("")
return (
<div className="border">
<login className={"login-container"}>
<p className={"font-big-fat placement"}>Login</p>
<div className={"placement"}>
<br/>
<p className={"font-kinda-big"}>Username</p>
<input type="text" value={inputUserName} onChange={e => setInputUserName(e.target.value)} placeholder="Type here" className="input input-bordered input-sm w-full max-w-xs"/>
<br/>
<p className={"font-kinda-big"}>Password</p>
<input type="password" value={inputPassword} onChange={e => setInputPassword(e.target.value)} placeholder="Type here" className="input input-bordered input-sm w-full max-w-xs"/>
</div>
<Button text={"Login"} color={"#e2001a"} width={"25px"} onClick={() => on_login_click()}/>
</login>
</div>
);
}