import { useSession } from 'next-auth/client'; import { EmojiHappyIcon } from "@heroicons/react/outline"; import { CameraIcon,VideoCameraIcon } from "@heroicons/react/solid"; import{ useRef } from "react"; import { db } from "../../firebase"; import firebase from "../../firebase"; function InputBox() { const [session]=useSession(); const inputRef=useRef(null); const sendPost = (e) => { e.preventDefault(); if(!inputRef.current.value) return; db.collection('posts').add({ message: inputRef.current.value, name: session.user.name, email: session.user.email, image: session.user.image, timestamp: firebase.firestore.FieldValue.serverTimestamp() }) inputRef.current.value=""; };
import firebase from "./firebase"; import "firebase/storage"; const app = !firebase.apps.length ? firebase.initializeApp(firebaseConfig) : firebase.app() ; const db = app.firestore(); const storage= firebase.storage(); export { db, storage };
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)