2021-06-21 22:58:08 +00:00
|
|
|
import React from "react";
|
2021-06-22 23:26:55 +00:00
|
|
|
import { useState } from "react/cjs/react.development";
|
2021-06-21 22:58:08 +00:00
|
|
|
import "../../App.css";
|
|
|
|
import Footer from "../../Footer";
|
|
|
|
import InputField from "../InputField";
|
|
|
|
import SubmitField from "../SubmitField";
|
|
|
|
|
|
|
|
export default function Login() {
|
2021-06-22 23:26:55 +00:00
|
|
|
const [username, setUsername] = useState('')
|
|
|
|
const [password, setPassword] = useState('')
|
|
|
|
|
|
|
|
const onSubmitClick = (e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
let opts = {
|
|
|
|
username: username,
|
|
|
|
password: password,
|
|
|
|
};
|
|
|
|
console.log(opts);
|
|
|
|
fetch("/api/register", {
|
|
|
|
method: "post",
|
|
|
|
body: JSON.stringify(opts),
|
|
|
|
})
|
|
|
|
};
|
|
|
|
|
|
|
|
const handleUsernameChange = (e) => {
|
|
|
|
setUsername(e.target.value);
|
|
|
|
};
|
|
|
|
|
|
|
|
const handlePasswordChange = (e) => {
|
|
|
|
setPassword(e.target.value);
|
|
|
|
};
|
|
|
|
|
2021-06-21 22:58:08 +00:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div className="sitePage">
|
|
|
|
<h1>Registrierung</h1>
|
|
|
|
<form>
|
|
|
|
<InputField
|
|
|
|
LabelName="Benutzername / Kennung"
|
2021-06-22 23:26:55 +00:00
|
|
|
InputType="text"
|
|
|
|
onChange={handleUsernameChange}
|
2021-06-21 22:58:08 +00:00
|
|
|
InputName="username"
|
|
|
|
/>
|
|
|
|
<InputField
|
|
|
|
LabelName="Passwort"
|
|
|
|
InputType="password"
|
2021-06-22 23:26:55 +00:00
|
|
|
onChange={handlePasswordChange}
|
2021-06-21 22:58:08 +00:00
|
|
|
InputName="password"
|
|
|
|
/>
|
|
|
|
<br />
|
2021-06-22 23:26:55 +00:00
|
|
|
<SubmitField onClick={onSubmitClick} LabelName="Einloggen" />
|
2021-06-21 22:58:08 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<Footer />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|