Add Firebase Storage for Book Covers
This commit is contained in:
parent
07cecb819c
commit
93b4f2de62
|
@ -12,6 +12,7 @@ import { getFirestore,
|
||||||
query,
|
query,
|
||||||
where,
|
where,
|
||||||
getDocs } from "firebase/firestore";
|
getDocs } from "firebase/firestore";
|
||||||
|
import {getStorage} from "firebase/storage"
|
||||||
|
|
||||||
import { Header } from "./components/Header"
|
import { Header } from "./components/Header"
|
||||||
import './App.css'
|
import './App.css'
|
||||||
|
@ -24,6 +25,7 @@ import { Signin } from "./pages/Signin"
|
||||||
|
|
||||||
// contexts
|
// contexts
|
||||||
import { AuthContext } from "./contexts/AuthContext"
|
import { AuthContext } from "./contexts/AuthContext"
|
||||||
|
import { StorageContext } from "./contexts/StorageContext";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +33,7 @@ function App() {
|
||||||
const FBapp = initializeApp(FirebaseConfig)
|
const FBapp = initializeApp(FirebaseConfig)
|
||||||
const FBauth = getAuth(FBapp)
|
const FBauth = getAuth(FBapp)
|
||||||
const FBdb = getFirestore(FBapp)
|
const FBdb = getFirestore(FBapp)
|
||||||
|
const FBstorage = getStorage(FBapp)
|
||||||
|
|
||||||
|
|
||||||
// navigation array
|
// navigation array
|
||||||
|
@ -129,6 +132,7 @@ const readData = async () => {
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<Header items={nav} user={auth} />
|
<Header items={nav} user={auth} />
|
||||||
<AuthContext.Provider value={auth}>
|
<AuthContext.Provider value={auth}>
|
||||||
|
<StorageContext.Provider value={FBstorage}>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<Home items = {data} />} />
|
<Route path="/" element={<Home items = {data} />} />
|
||||||
<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} />} />
|
||||||
|
@ -137,6 +141,7 @@ const readData = async () => {
|
||||||
<Route path="/signout" element={ <Signout handler={logOut}/> } />
|
<Route path="/signout" element={ <Signout handler={logOut}/> } />
|
||||||
<Route path="/signin" element={ <Signin handler={signIn} authstate={auth}/> } />
|
<Route path="/signin" element={ <Signin handler={signIn} authstate={auth}/> } />
|
||||||
</Routes>
|
</Routes>
|
||||||
|
</StorageContext.Provider>
|
||||||
</AuthContext.Provider>
|
</AuthContext.Provider>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
import { createContext } from "react";
|
||||||
|
|
||||||
|
export const StorageContext = createContext()
|
Loading…
Reference in New Issue