login failed (#64)

This commit is contained in:
Michael Quigley 2022-09-20 16:10:21 -04:00
parent 242a8bee7b
commit 073507e0e0
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 9 additions and 0 deletions

View File

@ -4,6 +4,9 @@ import * as identity from './api/identity';
const Login = (props) => { const Login = (props) => {
const [email, setEmail] = useState(''); const [email, setEmail] = useState('');
const [password, setPassword] = useState(''); const [password, setPassword] = useState('');
const [failed, setFailed] = useState();
const errorMessage = <h2 className={"errorMessage"}>Login Failed!</h2>;
const handleSubmit = async e => { const handleSubmit = async e => {
e.preventDefault() e.preventDefault()
@ -21,6 +24,7 @@ const Login = (props) => {
console.log('login succeeded', resp) console.log('login succeeded', resp)
} else { } else {
console.log('login failed') console.log('login failed')
setFailed(errorMessage);
} }
}) })
.catch((resp) => { .catch((resp) => {
@ -32,6 +36,7 @@ const Login = (props) => {
<div className={"fullscreen"}> <div className={"fullscreen"}>
<img src={"ziggy.svg"} width={200}/> <img src={"ziggy.svg"} width={200}/>
<h1>zrok</h1> <h1>zrok</h1>
{failed}
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>
<fieldset> <fieldset>
<legend>Log In</legend> <legend>Log In</legend>

View File

@ -134,3 +134,7 @@ h1, h2, h3, h4, h5, h6 {
svg.flowNode { svg.flowNode {
vertical-align: middle; vertical-align: middle;
} }
.errorMessage {
color: deeppink;
}