diff --git a/src/App.js b/src/App.js index 9d1e00e..214383e 100644 --- a/src/App.js +++ b/src/App.js @@ -27,6 +27,7 @@ import { Detail } from "./pages/Detail"; // contexts import { AuthContext } from "./contexts/AuthContext" import { StorageContext } from "./contexts/StorageContext"; +import { FSContext } from "./contexts/FSContext"; @@ -145,6 +146,7 @@ const readData = async () => {
+ } /> } /> @@ -154,6 +156,7 @@ const readData = async () => { } /> } /> + diff --git a/src/components/ReviewForm.js b/src/components/ReviewForm.js index ae0c065..8361189 100644 --- a/src/components/ReviewForm.js +++ b/src/components/ReviewForm.js @@ -2,7 +2,9 @@ import Form from "react-bootstrap/Form" import Button from "react-bootstrap/Button" import { AuthContext } from "../contexts/AuthContext" +import { FSContext } from "../contexts/FSContext" import { useContext, useState } from "react" +import { collection, addDoc } from "firebase/firestore"; const submitHandler = (event) => { event.preventDefault() @@ -10,6 +12,8 @@ event.preventDefault() export function ReviewForm(props) { const auth = useContext(AuthContext) + const db = useContext(FSContext) + const[star, setStar ] = useState() const[title, setTitle ] = useState() const[review, setReview ] = useState() diff --git a/src/contexts/FSContext.js b/src/contexts/FSContext.js new file mode 100644 index 0000000..1a8452d --- /dev/null +++ b/src/contexts/FSContext.js @@ -0,0 +1,3 @@ +import { createContext } from 'react'; + +export const FSContext = createContext() \ No newline at end of file diff --git a/src/pages/Detail.js b/src/pages/Detail.js index 167966b..6475fbd 100644 --- a/src/pages/Detail.js +++ b/src/pages/Detail.js @@ -50,7 +50,7 @@ export function Detail(props) { - +