add - loading spinner, administration, navbar modfications
This commit is contained in:
1 parent
6a10740307
commit
27187c6c68
28 files changed
+886
-116
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import { createContext, ReactNode, useContext, useState } from "react";
|
||||
|
||||
export type IGlobalContextProps = {
|
||||
role: string;
|
||||
setRole: (role: string) => void;
|
||||
};
|
||||
|
||||
export const globalContextDefaultValues: IGlobalContextProps = {
|
||||
role: null,
|
||||
setRole: () => { },
|
||||
}
|
||||
|
||||
export const GlobalContext = createContext<IGlobalContextProps>(globalContextDefaultValues);
|
||||
|
||||
type Props = {
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
export const GlobalContextProvider = (props: Props) => {
|
||||
const [role, setCurrentRole] = useState(null)
|
||||
|
||||
return (
|
||||
<GlobalContext.Provider
|
||||
value={{
|
||||
role: role,
|
||||
setRole: setCurrentRole,
|
||||
}}
|
||||
>
|
||||
{props.children}
|
||||
</GlobalContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
// import { useGlobalContext } from 'context';
|
||||
// const { user } = useGlobalContext();
|
||||
|
||||
// Pour utiliser le context n'importe ou
|
||||
Reference in new issue
Block a user