Vareious corrections so it stores data in firestore correctly.

This commit is contained in:
Ray 2023-12-29 09:04:44 +00:00 committed by GitHub
parent 62d3224651
commit afdbafe52c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 5 deletions

View File

@ -19,10 +19,6 @@ import 'bootstrap/dist/css/bootstrap.min.css';
import Col from 'react-bootstrap/Col'; import Col from 'react-bootstrap/Col';
import './App.css' import './App.css'
// Import custom contexts
import { FSContext } from ".//contexts/FSContext.js"
if (!getApps().length) { if (!getApps().length) {
initializeApp(firebaseConfig); initializeApp(firebaseConfig);
} }
@ -66,7 +62,7 @@ const db = getFirestore(getApp());
const submitHandler = async (event) => { const submitHandler = async (event) => {
event.preventDefault() event.preventDefault()
const incidentsData = { submitter, date, context, selectedOptions } // Use the state variables directly const incidentsData = { submitter, date, context, selectedOptions } // Use the state variables directly
const col = collection(db, `incidents/${props.incidentId}/incident_logs`) const col = collection(db, `incidents`)
const ref = await addDoc(col, incidentsData) const ref = await addDoc(col, incidentsData)
console.log(ref) console.log(ref)
} }