diff --git a/src/App.js b/src/App.js
index ab4ea1e..307c14a 100644
--- a/src/App.js
+++ b/src/App.js
@@ -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: "/" },
@@ -42,11 +42,13 @@ function App() {
// signing up a user
const signUp = (email, password) => {
createUserWithEmailAndPassword(FBauth, email, password)
- .then((userCredential) => {
+ .then( (userCredential) => {
// do something
})
.catch((error) => console.log(error.message))
}
+
+
return (
@@ -54,7 +56,7 @@ function App() {
} />
} />
} />
- } />
+ } />
);
diff --git a/src/pages/Signup.js b/src/pages/Signup.js
index e70b395..6c3d0cb 100644
--- a/src/pages/Signup.js
+++ b/src/pages/Signup.js
@@ -6,50 +6,51 @@ import Button from "react-bootstrap/Button"
import {useState, useEffect} from 'react';
export function Signup ( props ) {
- const[username,setUsername] = useState('')
+ const[username,setUsername] = useState('')
const[validusername,setValidusername] = useState(false)
- const[useremail,setUseremail] = useState('')
- const[validemail,setValidemail] = useState(false)
- const[password,setUserpassword] = useState('')
+ const[useremail,setUseremail] = useState('')
+ const[validemail,setValidemail] = useState(false)
+ const[userpassword,setUserpassword] = useState('')
const[validpassword,setValidpassword] = useState(false)
+
const submitHandler = (evt) => {
- evt.preventDefault()
- props.handler(useremail, password)
+ evt.preventDefault()
+ props.handler( useremail, userpassword )
}
-
+
useEffect( () => {
- if(username.length >= 4) {
- setValidusername(true)
- }
- else {
- setValidusername(false)
- }
- }, [username] )
-
- useEffect( () => {
- if(useremail.indexOf('@') > 0 ) {
- setValidemail(true)
- }
- else {
- setValidemail(false)
- }
- }, [useremail] )
-
- useEffect( () => {
- if( password.length >= 8 ) {
- setValidpassword(true)
- }
- else{
- setValidpassword(false)
- }
- }, [password] )
+ if( username.length >= 4 ) {
+ setValidusername(true)
+ }
+ else {
+ setValidusername(false)
+ }
+ }, [username] )
+
+ useEffect( () => {
+ if( useremail.indexOf('@') > 0 ) {
+ setValidemail(true)
+ }
+ else {
+ setValidemail(false)
+ }
+ }, [useremail])
+
+ useEffect( () => {
+ if( userpassword.length >= 8 ) {
+ setValidpassword(true)
+ }
+ else{
+ setValidpassword(false)
+ }
+ }, [userpassword])
return (
-
Username