authentification nocodebackend ok
This commit is contained in:
14
AuthContext.tsx
Normal file
14
AuthContext.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import React, { createContext, useContext } from 'react';
|
||||
import { useAuth as useAuthHook } from './hooks';
|
||||
|
||||
const AuthContext = createContext<any>(null);
|
||||
|
||||
export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
||||
const auth = useAuthHook();
|
||||
return <AuthContext.Provider value={auth}>{children}</AuthContext.Provider>;
|
||||
};
|
||||
|
||||
// Ce hook permettra d'accéder à l'auth n'importe où
|
||||
export function useAuthContext() {
|
||||
return useContext(AuthContext);
|
||||
}
|
||||
Reference in New Issue
Block a user