Added Route path for Signout
This commit is contained in:
parent
5628b1dc1e
commit
d5ee3f272d
|
@ -2,7 +2,7 @@ import { FirebaseConfig } from "./config/Config"
|
||||||
import { initializeApp } from "firebase/app"
|
import { initializeApp } from "firebase/app"
|
||||||
import { Routes, Route } from "react-router-dom"
|
import { Routes, Route } from "react-router-dom"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { getAuth, createUserWithEmailAndPassword, onAuthStateChanged } from "firebase/auth";
|
import { getAuth, createUserWithEmailAndPassword, onAuthStateChanged, signOut } from "firebase/auth";
|
||||||
|
|
||||||
import { Header } from "./components/Header"
|
import { Header } from "./components/Header"
|
||||||
import './App.css'
|
import './App.css'
|
||||||
|
@ -66,7 +66,11 @@ function App() {
|
||||||
.catch((error) => console.log(error.message))
|
.catch((error) => console.log(error.message))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const logOut = () => {
|
||||||
|
signOut(FBauth).then( () => {
|
||||||
|
// user is signed out
|
||||||
|
})
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<Header items={nav} />
|
<Header items={nav} />
|
||||||
|
@ -75,6 +79,7 @@ function App() {
|
||||||
<Route path="/about" element={<About greeting="Hey you, this is about page!" handler={saySomething} />} />
|
<Route path="/about" element={<About greeting="Hey you, this is about page!" handler={saySomething} />} />
|
||||||
<Route path="/contact" element={<Contact greeting="Hey you, this is contact page!" />} />
|
<Route path="/contact" element={<Contact greeting="Hey you, this is contact page!" />} />
|
||||||
<Route path="/signup" element={ <Signup handler={signUp}/> } />
|
<Route path="/signup" element={ <Signup handler={signUp}/> } />
|
||||||
|
<Route path="/signout" element={ <Signout handler={logOut}/> } />
|
||||||
</Routes>
|
</Routes>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue