Save auth in localstorage and use it

Also consistently call it "email".
This commit is contained in:
Eli Ribble 2024-08-27 11:11:54 -07:00
parent 34ea77f7c3
commit 913856c11b
2 changed files with 24 additions and 16 deletions

View file

@ -5,10 +5,10 @@ import Modal from "react-bootstrap/Modal"
import React, {useState} from "react"
type AuthProps = {
doLogin: (email: string, password: string) => void;
onLogin: (email: string, password: string) => void;
}
const AuthModal: React.FC<AuthProps> = ({ doLogin }) => {
const AuthModal: React.FC<AuthProps> = ({ onLogin }) => {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
@ -23,7 +23,7 @@ const AuthModal: React.FC<AuthProps> = ({ doLogin }) => {
</Modal.Header>
<Modal.Body>
<Form onSubmit={(e) => {e.preventDefault(); doLogin(email, password)}}>
<Form onSubmit={(e) => {e.preventDefault(); onLogin(email, password)}}>
<Form.Group className="mb-3" controlId="formBasicEmail">
<Form.Label>Email address</Form.Label>
<Form.Control type="email" placeholder="Enter email" onChange={e => setEmail(e.target.value)}/>