{"size": 712, "ext": "js", "max_stars_repo_path": "dist/hooks/useAuthHook.js", "max_stars_repo_name": "FreddyGames69/EasyFirebase", "max_stars_repo_stars_event_min_datetime": "2021-12-23T10:36:33.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-23T10:36:33.000Z", "max_issues_repo_path": "dist/hooks/useAuthHook.js", "max_issues_repo_name": "FreddyGames69/EasyFirebase", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "dist/hooks/useAuthHook.js", "max_forks_repo_name": "FreddyGames69/EasyFirebase", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.6666666667, "max_line_length": 64, "alphanum_fraction": 0.5674157303}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useAuthHook = void 0;
const react_1 = require("react");
const auth_1 = require("firebase/auth");
function useAuthHook() {
    const auth = (0, auth_1.getAuth)();
    const [userAuth, setUserAuth] = (0, react_1.useState)(null);
    (0, react_1.useEffect)(() => {
        const unsuscribe = auth.onAuthStateChanged((user) => {
            if (user) {
                setUserAuth(user);
            }
            else {
                setUserAuth(null);
            }
        });
        return () => unsuscribe();
        // eslint-disable-next-line
    }, [userAuth]);
    return userAuth;
}
exports.useAuthHook = useAuthHook;
