Various repairs to broken signup button not submitting data

This commit is contained in:
Ray 2023-09-18 14:09:45 +00:00 committed by GitHub
parent d65f8e720f
commit 3f05cd8dfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 36 deletions

View File

@ -14,7 +14,7 @@ import { Signup } from "./pages/Signup"
function App() { function App() {
const FBapp = initializeApp(FirebaseConfig) const FBapp = initializeApp(FirebaseConfig)
const FBauth = getAuth(FBapp) const FBauth = getAuth()
// navigation array // navigation array
const navItems = [ const navItems = [
{ label: "Home", link: "/" }, { label: "Home", link: "/" },
@ -47,6 +47,8 @@ function App() {
}) })
.catch((error) => console.log(error.message)) .catch((error) => console.log(error.message))
} }
return ( return (
<div className="App"> <div className="App">
<Header items={nav} /> <Header items={nav} />

View File

@ -10,11 +10,12 @@ export function Signup ( props ) {
const[validusername,setValidusername] = useState(false) const[validusername,setValidusername] = useState(false)
const[useremail,setUseremail] = useState('') const[useremail,setUseremail] = useState('')
const[validemail,setValidemail] = useState(false) const[validemail,setValidemail] = useState(false)
const[password,setUserpassword] = useState('') const[userpassword,setUserpassword] = useState('')
const[validpassword,setValidpassword] = useState(false) const[validpassword,setValidpassword] = useState(false)
const submitHandler = (evt) => { const submitHandler = (evt) => {
evt.preventDefault() evt.preventDefault()
props.handler(useremail, password) props.handler( useremail, userpassword )
} }
useEffect( () => { useEffect( () => {
@ -36,20 +37,20 @@ export function Signup ( props ) {
}, [useremail]) }, [useremail])
useEffect( () => { useEffect( () => {
if( password.length >= 8 ) { if( userpassword.length >= 8 ) {
setValidpassword(true) setValidpassword(true)
} }
else{ else{
setValidpassword(false) setValidpassword(false)
} }
}, [password] ) }, [userpassword])
return ( return (
<Container> <Container>
<Row> <Row>
<Col md={{span: 4, offset:4}}> <Col md={{span: 4, offset:4}}>
<Form> <Form onSubmit={submitHandler}>
<Form.Group> <Form.Group>
<Form.Label>Username</Form.Label> <Form.Label>Username</Form.Label>
<Form.Control <Form.Control