diff --git a/frontend/src/components/Input.css b/frontend/src/components/Input.css index 63f9233..4f4109e 100644 --- a/frontend/src/components/Input.css +++ b/frontend/src/components/Input.css @@ -38,4 +38,4 @@ form { .input-field label { font-size: 1.5em; -} \ No newline at end of file +} diff --git a/frontend/src/components/pages/Register.js b/frontend/src/components/pages/Register.js index 983e5a6..3129939 100644 --- a/frontend/src/components/pages/Register.js +++ b/frontend/src/components/pages/Register.js @@ -4,6 +4,7 @@ import "../../App.css"; import Footer from "../../Footer"; import InputField from "../InputField"; import SubmitField from "../SubmitField"; +import "../Input.css" export default function Login() { const [username, setUsername] = useState(""); @@ -21,15 +22,17 @@ export default function Login() { method: "post", body: JSON.stringify(opts), }).then((response) => { + console.log(response) if (response.status === 409) { - console.log(response); - console.log( - "Benutzername wird bereits verwendet. Wähle einen Anderen (source: console.log)" - ); - let response_json = response.json(); - console.log(response_json); - let response_message = response_json.message; - console.log(response_message); + /* + then is needed twice to get rid of the javascript Promise thing + */ + response.json().then((resp2) => { + setMessage(resp2.message) + }); + } + else if (response.status === 200) { + //TODO redirect to login #77 or #74 } }); }; @@ -53,6 +56,7 @@ export default function Login() { onChange={handleUsernameChange} InputName="username" /> +
{message}