diff --git a/src/App.js b/src/App.js index f4467eb..9930120 100644 --- a/src/App.js +++ b/src/App.js @@ -2,7 +2,11 @@ import { FirebaseConfig } from "./config/Config" import { initializeApp } from "firebase/app" import { Routes, Route } from "react-router-dom" import { useState } from "react" -import { getAuth, createUserWithEmailAndPassword, onAuthStateChanged, signOut } from "firebase/auth"; +import { getAuth, + createUserWithEmailAndPassword, + onAuthStateChanged, + signOut, + signInWithEmailAndPassword } from "firebase/auth"; import { Header } from "./components/Header" import './App.css' @@ -11,6 +15,7 @@ import { Home } from "./pages/Home" import { Contact } from "./pages/Contact" import { Signup } from "./pages/Signup" import { Signout } from "./pages/Signout" +import { Signin } from "./pages/Signin" function App() { @@ -70,6 +75,14 @@ function App() { signOut(FBauth).then( () => { // user is signed out }) +} + +const signIn = ( email, password ) => { + signInWithEmailAndPassword(FBauth, email, password) + .then( () => { + // user is signed in +} ) +.catch( (error) => { console.log(error) }) } return (
@@ -80,6 +93,7 @@ function App() { } /> } /> } /> + } />
); diff --git a/src/pages/Signin.js b/src/pages/Signin.js new file mode 100644 index 0000000..89b063b --- /dev/null +++ b/src/pages/Signin.js @@ -0,0 +1,66 @@ +import Form from 'react-bootstrap/Form'; +import Container from 'react-bootstrap/Container'; +import Row from 'react-bootstrap/Row'; +import Col from 'react-bootstrap/Col'; +import Button from "react-bootstrap/Button" +import {useState, useEffect} from 'react'; + +export function Signin ( props ) { + return ( + + + + +
+ + + + Email + + + + + + + + Password + + + + + + +
+ + + +
+ +
+ ) +} \ No newline at end of file diff --git a/src/pages/Signout.js b/src/pages/Signout.js index 9efb1ad..77e6f20 100644 --- a/src/pages/Signout.js +++ b/src/pages/Signout.js @@ -1,9 +1,21 @@ -export function Signout() { +import { useEffect } from 'react'; +import { Container, Row, Col } from 'react-bootstrap'; +import { useNavigate } from 'react-router-dom'; + +export function Signout( props ) { +const nav = useNavigate() + +useEffect(() => { + props.handler() + nav("/") + +}) + return ( - Signout + {/*Signout*/}