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

View File

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