diff --git a/anwendung/src/components/Login.jsx b/anwendung/src/components/Login.jsx
index f1416fc..227d693 100644
--- a/anwendung/src/components/Login.jsx
+++ b/anwendung/src/components/Login.jsx
@@ -5,17 +5,32 @@ export default function Login() {
let url = "http://localhost:8080/users"
- function on_login_click()
- {
+ async function on_login_click() {
url += "?mail=" + inputUserName + "&password=" + inputPassword;
- fetch(url, {
+ let response = await fetch(url, {
method: "GET",
- }).then(r => console.log())
+ });
+
+ let reader = response.body.getReader();
+ let value = String.fromCharCode.apply(null, ((await reader.read()).value))
+ if(value != "failed")
+ {
+ localStorage.setItem("sessionid", value)
+ }
+ else
+ {
+ setInputPassword("");
+ setInputUserName("");
+ setHint("wrong login credentials")
+ setBackgroundColor("rgb(171,89,89)")
+ }
}
const [inputUserName, setInputUserName] = useState("")
const [inputPassword, setInputPassword] = useState("")
+ const [hint, setHint] = useState("type here")
+ const [backgroundColor, setBackgroundColor] = useState("rgb(255, 255, 255)")
return (
@@ -24,10 +39,16 @@ export default function Login() {