Feat: Sync entre addRessources et gestionRessources
This commit is contained in:
@@ -37,6 +37,19 @@ export async function getRessources(): Promise<Ressources[]> {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
//ADD RESSOURCES
|
||||
export async function addRessources(ressourceData: Omit<Ressources, 'id'>): Promise<string | null> {
|
||||
try {
|
||||
const colRef = collection(db, "ressources");
|
||||
const ressourcesRef = await addDoc(colRef, ressourceData);
|
||||
console.log(`Ressource ajoutée avec ID: ${ressourcesRef.id}`);
|
||||
return ressourcesRef.id;
|
||||
} catch (err) {
|
||||
console.error("Error adding:", err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
///////////////////////////////////CHANTIER/////////////////////////////////
|
||||
export async function getChantiers(): Promise<Chantier[]> {
|
||||
const snap = await getDocs(collection(db, "chantier"));
|
||||
|
||||
Reference in New Issue
Block a user