Save the username and password, show an alert to prove it.
This commit is contained in:
parent
9ff63d96fd
commit
c6400d58d3
2 changed files with 12 additions and 7 deletions
|
|
@ -2,13 +2,16 @@ import Button from "react-bootstrap/Button"
|
|||
import Form from "react-bootstrap/Form"
|
||||
import Modal from "react-bootstrap/Modal"
|
||||
|
||||
import React from "react"
|
||||
import React, {useState} from "react"
|
||||
|
||||
type AuthProps = {
|
||||
doLogin: () => void;
|
||||
doLogin: (email: string, password: string) => void;
|
||||
}
|
||||
|
||||
const AuthModal: React.FC<AuthProps> = ({ doLogin }) => {
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
|
||||
return (
|
||||
<div
|
||||
className="modal show"
|
||||
|
|
@ -23,7 +26,7 @@ const AuthModal: React.FC<AuthProps> = ({ doLogin }) => {
|
|||
<Form>
|
||||
<Form.Group className="mb-3" controlId="formBasicEmail">
|
||||
<Form.Label>Email address</Form.Label>
|
||||
<Form.Control type="email" placeholder="Enter email" />
|
||||
<Form.Control type="email" placeholder="Enter email" onChange={e => setEmail(e.target.value)}/>
|
||||
<Form.Text className="text-muted">
|
||||
We'll never share your email with anyone else.
|
||||
</Form.Text>
|
||||
|
|
@ -31,13 +34,13 @@ const AuthModal: React.FC<AuthProps> = ({ doLogin }) => {
|
|||
|
||||
<Form.Group className="mb-3" controlId="formBasicPassword">
|
||||
<Form.Label>Password</Form.Label>
|
||||
<Form.Control type="password" placeholder="Password" />
|
||||
<Form.Control type="password" placeholder="Password" onChange={e => setPassword(e.target.value)}/>
|
||||
</Form.Group>
|
||||
</Form>
|
||||
</Modal.Body>
|
||||
|
||||
<Modal.Footer>
|
||||
<Button variant="primary" onClick={doLogin}>Login</Button>
|
||||
<Button variant="primary" onClick={() => {doLogin(email, password)}}>Login</Button>
|
||||
</Modal.Footer>
|
||||
</Modal.Dialog>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue