test with firebase

This commit is contained in:
tuanvu
2025-12-09 13:32:09 +01:00
parent b0be1e98d9
commit 3bd08147e3
5 changed files with 307 additions and 297 deletions

View File

@@ -1,5 +1,5 @@
import { Chantier, Chef, exempleChantier } from '@/class/class';
import { createContext, ReactNode, useContext, useMemo, useState } from 'react';
import { Chantier } from "@/class/class";
import { createContext, ReactNode, useContext, useMemo, useState } from "react";
type ChantierContextType = {
chantier: Chantier | null;
@@ -15,10 +15,7 @@ type ChantierProviderProps = {
export const ChantierProvider = ({ children }: ChantierProviderProps) => {
const [chantier, setChantier] = useState<Chantier | null>(null);
const value = useMemo(
() => ({ chantier, setChantier }),
[chantier]
);
const value = useMemo(() => ({ chantier, setChantier }), [chantier]);
return (
<ChantierContext.Provider value={value}>
@@ -30,7 +27,7 @@ export const ChantierProvider = ({ children }: ChantierProviderProps) => {
export const useChantier = () => {
const context = useContext(ChantierContext);
if (!context) {
throw new Error('useChantier doit être utilisé dans <ChantierProvider>');
throw new Error("useChantier doit être utilisé dans <ChantierProvider>");
}
return context;
};
};