diff options
Diffstat (limited to 'panel/src/contexts')
-rw-r--r-- | panel/src/contexts/AuthContext.jsx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/panel/src/contexts/AuthContext.jsx b/panel/src/contexts/AuthContext.jsx index cf8c7b5..f4f9383 100644 --- a/panel/src/contexts/AuthContext.jsx +++ b/panel/src/contexts/AuthContext.jsx @@ -10,10 +10,12 @@ export const useAuth = () => { export const AuthProvider = ({ children }) => { const [currentUser, setCurrentUser] = useState(null); + const [loading, setLoading] = useState(true); useEffect(() => { const unsubscribe = onAuthStateChanged(auth, (user) => { setCurrentUser(user); + setLoading(false); }); return unsubscribe; @@ -23,5 +25,9 @@ export const AuthProvider = ({ children }) => { currentUser, }; - return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>; + return ( + <AuthContext.Provider value={value}> + {!loading && children} + </AuthContext.Provider> + ); }; |