2022-01-06 01:26:15 +00:00
|
|
|
import React, { createContext } from "react";
|
|
|
|
|
|
|
|
import useAuth from "../../hooks/useAuth.js";
|
|
|
|
|
|
|
|
const AuthContext = createContext();
|
|
|
|
|
|
|
|
const AuthProvider = ({ children }) => {
|
|
|
|
const { loading, user, isAuth, handleLogin, handleLogout } = useAuth();
|
|
|
|
|
2022-01-10 20:10:20 +00:00
|
|
|
//{console.log('authContext teste: ', user)}
|
|
|
|
|
2022-01-06 01:26:15 +00:00
|
|
|
return (
|
|
|
|
<AuthContext.Provider
|
|
|
|
value={{ loading, user, isAuth, handleLogin, handleLogout }}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</AuthContext.Provider>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export { AuthContext, AuthProvider };
|