aboutsummaryrefslogtreecommitdiffstats
path: root/panel/src/contexts
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-08-03 18:59:56 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-08-03 18:59:56 +0530
commitfae99f6a407de70fdba6029e45c194fb241c3433 (patch)
treecc148b86913a20e38ba5057783c5b80b08cf295b /panel/src/contexts
parent02af5124217f88a8c7419d963e5eee0fd72e32da (diff)
downloadadmin-panel-fae99f6a407de70fdba6029e45c194fb241c3433.tar.gz
admin-panel-fae99f6a407de70fdba6029e45c194fb241c3433.tar.bz2
admin-panel-fae99f6a407de70fdba6029e45c194fb241c3433.zip
Fixed routing issue with POPUP
Diffstat (limited to 'panel/src/contexts')
-rw-r--r--panel/src/contexts/AuthContext.jsx8
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>
+ );
};