Vareious corrections so it stores data in firestore correctly.
This commit is contained in:
parent
62d3224651
commit
afdbafe52c
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue