Merge branch 'main' of https://gitlab2.istic.univ-rennes1.fr/trochas/mmm-projet
This commit is contained in:
@@ -10,6 +10,6 @@ import { useRessources } from '../ContextRessource';
|
|||||||
|
|
||||||
export default function ajouterChantier() {
|
export default function ajouterChantier() {
|
||||||
const { chantier, setChantier } = useChantier();
|
const { chantier, setChantier } = useChantier();
|
||||||
const { artisant, setArtisant } = useArtisant();
|
//const { artisant, setArtisant } = useArtisant();
|
||||||
const { ressources, setRessources } = useRessources();
|
const { ressources, setRessources } = useRessources();
|
||||||
}
|
}
|
||||||
@@ -27,6 +27,7 @@ export default function RootLayout() {
|
|||||||
const [userRole, setUserRole] = useState<string | null>(null);
|
const [userRole, setUserRole] = useState<string | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
/*
|
||||||
const unsubscribe = onAuthStateChanged(auth, async (currentUser) => {
|
const unsubscribe = onAuthStateChanged(auth, async (currentUser) => {
|
||||||
if (!currentUser) {
|
if (!currentUser) {
|
||||||
router.replace("/login/login");
|
router.replace("/login/login");
|
||||||
@@ -59,6 +60,12 @@ export default function RootLayout() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return unsubscribe;
|
return unsubscribe;
|
||||||
|
*/
|
||||||
|
const timeout = setTimeout(() => {
|
||||||
|
router.replace("/(tabs)");
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
return () => clearTimeout(timeout);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -87,10 +87,7 @@ export default function SetStatus() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return(
|
return(
|
||||||
|
|
||||||
|
|
||||||
<Animated.View layout={LinearTransition.duration(200)} style={styles.windowBox}>
|
<Animated.View layout={LinearTransition.duration(200)} style={styles.windowBox}>
|
||||||
{isOpen && (<Pressable style={styles.autoClose} onPress={() => setIsOpen(false)}/>)}
|
{isOpen && (<Pressable style={styles.autoClose} onPress={() => setIsOpen(false)}/>)}
|
||||||
|
|
||||||
|
|||||||
@@ -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 { Chantier, Reservation, Ressources, User } from "../class/class";
|
||||||
import { db } from "../firebase_config";
|
import { db } from "../firebase_config";
|
||||||
|
|
||||||
@@ -90,4 +90,16 @@ export async function changeChantierStatus(chantierId: string, newStatus: string
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error", 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