From b03523cb8ddfbcd4cdac17eab3a5afe572284661 Mon Sep 17 00:00:00 2001 From: cami Date: Mon, 5 Jul 2021 18:00:01 +0200 Subject: [PATCH] Refactor the error messages (fix #102) All the errormessages use now the component ErrorMessage as it will be easier like this --- frontend/src/components/pages/Login.js | 3 ++- frontend/src/components/pages/Register.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/pages/Login.js b/frontend/src/components/pages/Login.js index 41deceb..cd399ee 100644 --- a/frontend/src/components/pages/Login.js +++ b/frontend/src/components/pages/Login.js @@ -6,6 +6,7 @@ import InputField from "../InputField"; import SubmitField from "../SubmitField"; import { login, useAuth, logout } from "../../auth/AuthProvider"; import Secret from "./Secret"; +import ErrorMessage from "../ErrorMessage"; export default function Login() { const [username, setUsername] = useState(""); @@ -65,7 +66,7 @@ export default function Login() { InputPlaceHolder="Passwort" />
-

{errorMessage}

+ ) : ( diff --git a/frontend/src/components/pages/Register.js b/frontend/src/components/pages/Register.js index 310601c..5d6f241 100644 --- a/frontend/src/components/pages/Register.js +++ b/frontend/src/components/pages/Register.js @@ -5,6 +5,7 @@ import Footer from "../../Footer"; import InputField from "../InputField"; import SubmitField from "../SubmitField"; import "../Input.css"; +import ErrorMessage from "../ErrorMessage"; export default function Login() { const [username, setUsername] = useState(""); @@ -61,7 +62,7 @@ export default function Login() { onChange={handleUsernameChange} InputName="username" /> - {!isStatusOk &&

{errorMessage}

} + {!isStatusOk && }