Refactor the error messages (fix #102) #103

Merged
cami merged 1 commit from refactor/errormessage into main 2021-07-05 16:00:38 +00:00
2 changed files with 4 additions and 2 deletions

View file

@ -6,6 +6,7 @@ import InputField from "../InputField";
import SubmitField from "../SubmitField"; import SubmitField from "../SubmitField";
import { login, useAuth, logout } from "../../auth/AuthProvider"; import { login, useAuth, logout } from "../../auth/AuthProvider";
import Secret from "./Secret"; import Secret from "./Secret";
import ErrorMessage from "../ErrorMessage";
export default function Login() { export default function Login() {
const [username, setUsername] = useState(""); const [username, setUsername] = useState("");
@ -65,7 +66,7 @@ export default function Login() {
InputPlaceHolder="Passwort" InputPlaceHolder="Passwort"
/> />
<br /> <br />
<p className="errorMessage">{errorMessage}</p> <ErrorMessage message={errorMessage}/>
<SubmitField onClick={onSubmitClick} LabelName="Einloggen" /> <SubmitField onClick={onSubmitClick} LabelName="Einloggen" />
</form> </form>
) : ( ) : (

View file

@ -5,6 +5,7 @@ import Footer from "../../Footer";
import InputField from "../InputField"; import InputField from "../InputField";
import SubmitField from "../SubmitField"; import SubmitField from "../SubmitField";
import "../Input.css"; import "../Input.css";
import ErrorMessage from "../ErrorMessage";
export default function Login() { export default function Login() {
const [username, setUsername] = useState(""); const [username, setUsername] = useState("");
@ -61,7 +62,7 @@ export default function Login() {
onChange={handleUsernameChange} onChange={handleUsernameChange}
InputName="username" InputName="username"
/> />
{!isStatusOk && <p className="errorMessage">{errorMessage}</p>} {!isStatusOk && <ErrorMessage message={errorMessage} />}
<InputField <InputField
LabelName="Passwort" LabelName="Passwort"
InputType="password" InputType="password"