react-garden
Version:
React + TypeScript + ThreeJS app using Material UI on NextJS, Apollo Client, GraphQL + WordPress REST APIs, for ThreeD web development.. a part of the threed.ai code family.
23 lines (17 loc) • 724 B
JavaScript
// ** React Imports
import { createContext, useContext } from 'react'
// ** Hooks Imports
import useFirebaseAuth from '~/hooks/useFirebaseAuth'
const authUserContext = createContext({
authUser: null,
loading: true,
signOut: async () => Promise.resolve(),
signInWithEmailAndPassword: async () => Promise.resolve(),
createUserWithEmailAndPassword: async () => Promise.resolve()
})
export const FirebaseAuthProvider = ({ children }) => {
const auth = useFirebaseAuth()
return <authUserContext.Provider value={auth}>{children}</authUserContext.Provider>
}
// custom hook to use the authUserContext and access authUser and loading
export const useAuth = () => useContext(authUserContext)