remove auth, re-add later
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { collection, doc, getDoc, getDocs, Timestamp, updateDoc } from "firebase/firestore";
|
||||
import { addDoc, collection, doc, getDoc, getDocs, Timestamp, updateDoc } from "firebase/firestore";
|
||||
import { Chantier, Reservation, Ressources, User } from "../class/class";
|
||||
import { db } from "../firebase_config";
|
||||
|
||||
@@ -90,4 +90,16 @@ export async function changeChantierStatus(chantierId: string, newStatus: string
|
||||
} catch (err) {
|
||||
console.error("Error", err);
|
||||
}
|
||||
}
|
||||
|
||||
export async function addChantier(chantierData: Omit<Chantier, 'id'>): Promise<string | null> {
|
||||
try {
|
||||
const colRef = collection(db, "chantier");
|
||||
const chantierRef = await addDoc(colRef, chantierData);
|
||||
//console.log(`Chantier added with ID: ${chantierRef.id}`);
|
||||
return chantierRef.id;
|
||||
} catch (err) {
|
||||
console.error("Error adding:", err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user