- fix issue with firebase-hooks

- implement custom useAuthState
This commit is contained in:
Amruth Pillai
2020-07-06 19:53:47 +05:30
parent 862ff7cdc1
commit 4e064dba96
11 changed files with 465 additions and 157 deletions

View File

@ -1,14 +1,15 @@
import firebase from "gatsby-plugin-firebase";
import { pick } from "lodash";
import React, { createContext, useEffect, useState } from "react";
import { useAuthState } from "react-firebase-hooks/auth";
import { toast } from "react-toastify";
import useAuthState from "../hooks/useAuthState";
const defaultUser = {
uid: null,
displayName: null,
email: null,
photoURL: null,
isAnonymous: false,
};
const defaultState = {
@ -20,7 +21,7 @@ const defaultState = {
const UserContext = createContext(defaultState);
const UserProvider = ({ children }) => {
const [firebaseUser, loading] = useAuthState(firebase.auth());
const [firebaseUser, loading] = useAuthState(firebase);
const [user, setUser] = useState(null);
useEffect(() => {